@pirireis/webglobeplugins 0.16.7 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Math/angle-calculation.js +1 -0
- package/Math/contour/quadtreecontours.js +300 -0
- package/Math/finite-line-2d.js +58 -0
- package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
- package/Math/tessellation/tile-merger.js +56 -0
- package/Math/tessellation/triangle-tessellation-meta.js +178 -32
- package/Math/tessellation/triangle-tessellation.js +5 -1
- package/compass-rose/compass-text-writer.js +39 -33
- package/constants.js +3 -0
- package/{util/heatwavedatamanager → heatwave}/datamanager.js +1 -1
- package/heatwave/{plugins/heatwaveglobeshell.js → heatwave.js} +8 -6
- package/heatwave/index.js +5 -3
- package/heatwave/{isobar/plugin.js → isobar.js} +6 -5
- package/{util/heatwavedatamanager → heatwave}/texture-point-sampler.js +24 -3
- package/package.json +4 -2
- package/programs/arrowfield/{object.js → arrow-field.js} +1 -1
- package/programs/arrowfield/logic.js +1 -1
- package/programs/data2legend/density-to-legend.js +24 -29
- package/programs/data2legend/point-to-density-texture.js +14 -17
- package/programs/float2legendwithratio/logic.js +2 -2
- package/programs/float2legendwithratio/object.js +1 -1
- package/programs/helpers/{blender/program.js → blender.js} +1 -1
- package/programs/helpers/{fadeaway/logic.js → fadeaway.js} +11 -2
- package/programs/index.js +20 -9
- package/programs/line-on-globe/circle-accurate-3d.js +12 -14
- package/programs/line-on-globe/circle-accurate-flat.js +0 -1
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +13 -15
- package/programs/line-on-globe/lines-color-instanced-flat.js +15 -18
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -1
- package/programs/picking/pickable-polygon-renderer.js +1 -1
- package/programs/picking/pickable-renderer.js +2 -2
- package/programs/point-on-globe/element-globe-surface-glow.js +2 -2
- package/programs/point-on-globe/element-point-glow.js +1 -1
- package/programs/point-on-globe/square-pixel-point.js +1 -1
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin-triangle.js +32 -6
- package/programs/polygon-on-globe/texture-dem-triangles.js +32 -5
- package/programs/rings/partial-ring/piece-of-pie.js +26 -29
- package/programs/totems/camerauniformblock.js +31 -42
- package/programs/two-d/pixel-padding-for-compass.js +14 -24
- package/programs/vectorfields/logics/drawrectangleparticles.js +1 -2
- package/programs/vectorfields/logics/pixelbased.js +1 -2
- package/programs/vectorfields/pingpongbuffermanager.js +1 -1
- package/range-tools-on-terrain/bearing-line/adapters.js +1 -1
- package/range-tools-on-terrain/circle-line-chain/adapters.js +0 -5
- package/range-tools-on-terrain/circle-line-chain/plugin.js +1 -1
- package/range-tools-on-terrain/range-ring/plugin.js +4 -6
- package/semiplugins/lightweight/line-plugin.js +0 -1
- package/semiplugins/shape-on-terrain/arc-plugin.js +0 -2
- package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
- package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -1
- package/semiplugins/shell/bbox-renderer/index.js +2 -0
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/logic.js +101 -102
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/object.js +6 -7
- package/semiplugins/utility/container-plugin.js +94 -0
- package/semiplugins/utility/object-pass-container-plugin.js +80 -0
- package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +1 -1
- package/{point-heat-map → tracks/point-heat-map}/plugin-webworker.js +3 -3
- package/{point-heat-map → tracks/point-heat-map}/point-to-heat-map-flow.js +11 -14
- package/{point-tracks → tracks/point-tracks}/plugin.js +5 -5
- package/{timetracks → tracks/timetracks}/adaptors-line-strip.js +1 -1
- package/{timetracks → tracks/timetracks}/program-line-strip.js +49 -49
- package/{timetracks → tracks/timetracks}/programpoint-line-strip.js +16 -13
- package/types.js +6 -0
- package/util/account/bufferoffsetmanager.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +9 -95
- package/util/gl-util/uniform-block/manager.js +0 -1
- package/util/gl-util/uniform-block/types.js +0 -7
- package/util/index.js +10 -13
- package/util/picking/fence.js +16 -18
- package/util/picking/picker-displayer.js +4 -6
- package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
- package/util/programs/draw-texture-on-canvas.js +1 -1
- package/util/programs/texturetoglobe.js +3 -3
- package/util/webglobe/rasteroverlay.js +1 -0
- package/vectorfield/arrowfield/index.js +3 -0
- package/{arrowfield → vectorfield/arrowfield}/plugin.js +2 -2
- package/{waveparticles → vectorfield/waveparticles}/plugin.js +12 -12
- package/{wind → vectorfield/wind}/index.js +1 -1
- package/{wind → vectorfield/wind}/plugin.js +32 -32
- package/write-text/attached-text-writer.js +9 -1
- package/write-text/context-text3.js +0 -1
- package/write-text/objectarraylabels/index.js +2 -0
- package/Math/tessellation/tessellation-algorithm.js +0 -67
- package/arrowfield/index.js +0 -3
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -444
- package/circle-line-chain/chain-list-map.js +0 -201
- package/circle-line-chain/plugin.js +0 -411
- package/circle-line-chain/util.js +0 -1
- package/compassrose/compassrose.js +0 -293
- package/compassrose/index.js +0 -2
- package/index.js +0 -12
- package/partialrings/buffer-manager.js +0 -75
- package/partialrings/index.js +0 -2
- package/partialrings/plugin.js +0 -128
- package/partialrings/program.js +0 -279
- package/programs/arrowfield/index.js +0 -2
- package/programs/globe-util/is-globe-moved.js +0 -19
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/wiggle/index.js +0 -2
- package/programs/helpers/blender/index.js +0 -1
- package/programs/helpers/fadeaway/index.js +0 -2
- package/programs/helpers/fadeaway/object.js +0 -14
- package/programs/helpers/index.js +0 -2
- package/programs/rings/distancering/circleflatprogram.js +0 -116
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -326
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -368
- package/programs/rings/distancering/index.js +0 -6
- package/programs/rings/distancering/paddyflatprogram.js +0 -127
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -129
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -128
- package/programs/two-d/pixel-circle.js +0 -1
- package/programs/vectorfields/index.js +0 -3
- package/rangerings/enum.js +0 -2
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -543
- package/rangerings/rangeringangletext.js +0 -326
- package/rangerings/ring-account.js +0 -112
- package/timetracks/index.js +0 -1
- package/util/build-strategy/general-strategy.js +0 -62
- package/util/gl-util/uniform-block/shader.js +0 -1
- package/util/heatwavedatamanager/index.js +0 -2
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/jshelpers/data-filler.js +0 -17
- package/util/jshelpers/equality.js +0 -18
- package/util/jshelpers/index.js +0 -2
- package/util/jshelpers/timefilters.js +0 -30
- package/util/programs/index.js +0 -1
- package/util/surface-line-data/arc-bboxes.js +0 -25
- package/util/surface-line-data/arcs-to-cuts.js +0 -50
- package/util/surface-line-data/cut-arc.js +0 -1
- package/util/surface-line-data/flow.js +0 -28
- package/util/surface-line-data/rbush-manager.js +0 -1
- package/util/surface-line-data/types.js +0 -1
- package/util/surface-line-data/web-worker.js +0 -1
- package/write-text/context-text3old.js +0 -152
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -8
- /package/{heatwave/isobar/quadtreecontours.js → Math/contour/quadtreecontours1.js} +0 -0
- /package/pin/{pin-object-array.js → pin-object-array1.js} +0 -0
- /package/pin/{pin-point-totem.js → pin-point-totem1.js} +0 -0
- /package/{circle-line-chain/init.js → programs/polygon-on-globe/partial-tesselation.js} +0 -0
- /package/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
- /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
- /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
- /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
- /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
- /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
- /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
- /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
package/partialrings/program.js
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { createProgram, shaderfunctions } from "../util";
|
|
2
|
-
import { CameraUniformBlockTotem, CameraUniformBlockString, noRegisterGlobeProgramCache, globeProgramCache } from "../programs";
|
|
3
|
-
import BufferManager from "./buffer-manager";
|
|
4
|
-
import { POLE, PI, longLatRadToMercator, mercatorXYToGLPosition, longLatRadToCartesian3D, circleLimpFromLongLatRadCenterCartesian3D, circleLimpFromLongLatRadCenterMercatorRealDistance, cartesian3DToGLPosition } from "../util/shaderfunctions/geometrytransformations";
|
|
5
|
-
/**
|
|
6
|
-
* TODO:
|
|
7
|
-
* 1. Triangle face looks at screen. if rotation angle is positive the last vertex must be the faintest.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
const drawModeMap = Object.freeze({
|
|
11
|
-
LINE_STRIP: 0,
|
|
12
|
-
TRIANGLE_FAN: 1,
|
|
13
|
-
});
|
|
14
|
-
const vertexShaderSource = `#version 300 es
|
|
15
|
-
|
|
16
|
-
${CameraUniformBlockString}
|
|
17
|
-
${PI}
|
|
18
|
-
${longLatRadToMercator}
|
|
19
|
-
${mercatorXYToGLPosition}
|
|
20
|
-
${longLatRadToCartesian3D}
|
|
21
|
-
${circleLimpFromLongLatRadCenterCartesian3D}
|
|
22
|
-
${circleLimpFromLongLatRadCenterMercatorRealDistance}
|
|
23
|
-
${cartesian3DToGLPosition}
|
|
24
|
-
|
|
25
|
-
uniform float edge_count;
|
|
26
|
-
uniform int draw_mode; // %2 => 0: LINE_STRIP, 1: TRIANGLE_FAN
|
|
27
|
-
uniform float plugin_alpha_multiplier;
|
|
28
|
-
//, lat, startAngle, tailAngle, ...rgba, radius, rgbaMode
|
|
29
|
-
in vec2 center; // long, lat in radian
|
|
30
|
-
in float start_angle; // the start of partial circle from bearing point
|
|
31
|
-
in float tail_angle; // the rotation of the partial circle
|
|
32
|
-
in vec4 color;
|
|
33
|
-
in float radius; // in meter
|
|
34
|
-
in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
|
|
35
|
-
// flat out int vid;
|
|
36
|
-
// flat out float v_phase;
|
|
37
|
-
out vec2 v_pos;
|
|
38
|
-
out vec4 v_color;
|
|
39
|
-
// flat out float v_angle;
|
|
40
|
-
|
|
41
|
-
void main() {
|
|
42
|
-
// vid = gl_VertexID;
|
|
43
|
-
if (color_mode == 2.0 || radius == 0.0) { return; }
|
|
44
|
-
float color_mode_ = color_mode;
|
|
45
|
-
if ( draw_mode == 0 && color_mode == 1.0) {color_mode_ = 0.0;}
|
|
46
|
-
float vertexID = float(gl_VertexID);
|
|
47
|
-
float radius_ = radius;
|
|
48
|
-
float alpha = plugin_alpha_multiplier;
|
|
49
|
-
if (draw_mode == 1) { // TRIANGLE_FAN
|
|
50
|
-
if (gl_VertexID == 0) {
|
|
51
|
-
radius_ = 0.0;
|
|
52
|
-
if ( color_mode == 1.0 ) { alpha = 0.0; }
|
|
53
|
-
}
|
|
54
|
-
vertexID -= 1.0;
|
|
55
|
-
}
|
|
56
|
-
float phase = ( vertexID / (edge_count - 1.0) );
|
|
57
|
-
// v_angle = tail_angle;
|
|
58
|
-
|
|
59
|
-
if ( color_mode_ == 1.0 ) {
|
|
60
|
-
if ( tail_angle < 0.0 ) {
|
|
61
|
-
v_color = vec4( color.rgb , color.a * ( 1.0 - phase ) * alpha );
|
|
62
|
-
} else {
|
|
63
|
-
v_color = vec4( color.rgb , color.a * phase * alpha );
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
v_color = vec4( color.rgb , color.a * alpha );
|
|
67
|
-
}
|
|
68
|
-
if ( color_mode == 0.0 && draw_mode == 1 ) {
|
|
69
|
-
v_color.a /= 2.0;
|
|
70
|
-
}
|
|
71
|
-
float angle;
|
|
72
|
-
if ( tail_angle > 0.0 ) {
|
|
73
|
-
angle = tail_angle * (-phase + 1.0) + start_angle;
|
|
74
|
-
} else {
|
|
75
|
-
angle = tail_angle * phase + start_angle;
|
|
76
|
-
}
|
|
77
|
-
if (is3D) {
|
|
78
|
-
|
|
79
|
-
vec3 pos = circleLimpFromLongLatRadCenterCartesian3D(center, radius_, angle);
|
|
80
|
-
v_pos = vec2(0.0, 0.0);
|
|
81
|
-
gl_Position = cartesian3DToGLPosition(pos);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
|
|
85
|
-
vec2 pos = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
|
|
86
|
-
v_pos = pos;
|
|
87
|
-
gl_Position = mercatorXYToGLPosition(pos);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
gl_PointSize = 10.0;
|
|
91
|
-
}`;
|
|
92
|
-
const fragmentShaderSource = `#version 300 es` + POLE + PI + `
|
|
93
|
-
precision highp float;
|
|
94
|
-
// flat in int vid;
|
|
95
|
-
in vec4 v_color;
|
|
96
|
-
in vec2 v_pos;
|
|
97
|
-
// flat in float v_phase;
|
|
98
|
-
// in float v_angle;
|
|
99
|
-
out vec4 outColor;
|
|
100
|
-
void main() {
|
|
101
|
-
// if( vid % 2 == 0 ) { discard; }
|
|
102
|
-
// if ( mod(v_angle, PI / 36.0 ) < (PI / 72.0)) { discard; }
|
|
103
|
-
// if ( mod(v_angle * v_phase, PI / 90.0 ) < (PI / 180.0)) { discard; }
|
|
104
|
-
if ( v_pos.x < -POLE || v_pos.x > POLE || v_pos.y < -POLE || v_pos.y > POLE ) { discard; }
|
|
105
|
-
outColor = v_color;
|
|
106
|
-
}`;
|
|
107
|
-
export const ITEM_SIZE = 10;
|
|
108
|
-
export class Logic {
|
|
109
|
-
constructor(globe) {
|
|
110
|
-
this.globe = globe;
|
|
111
|
-
this.gl = globe.gl;
|
|
112
|
-
this._lastMode = 0;
|
|
113
|
-
this._lastEdgeCount = 64;
|
|
114
|
-
this._lastAlphaMultiplier = 1.0;
|
|
115
|
-
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
116
|
-
const { gl, program } = this;
|
|
117
|
-
{ // set attributes locations
|
|
118
|
-
gl.bindAttribLocation(program, 0, 'center');
|
|
119
|
-
gl.bindAttribLocation(program, 1, 'start_angle');
|
|
120
|
-
gl.bindAttribLocation(program, 2, 'tail_angle');
|
|
121
|
-
gl.bindAttribLocation(program, 3, 'color');
|
|
122
|
-
gl.bindAttribLocation(program, 4, 'radius');
|
|
123
|
-
gl.bindAttribLocation(program, 5, 'color_mode');
|
|
124
|
-
// vao
|
|
125
|
-
// instanced draw read 1
|
|
126
|
-
}
|
|
127
|
-
{ // Uniforms
|
|
128
|
-
this._edgeCountLocation = gl.getUniformLocation(program, 'edge_count');
|
|
129
|
-
this._draw_modeLocation = gl.getUniformLocation(program, 'draw_mode');
|
|
130
|
-
this._plugin_alpha_multiplierLocation = gl.getUniformLocation(program, 'plugin_alpha_multiplier');
|
|
131
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
132
|
-
gl.useProgram(program);
|
|
133
|
-
gl.uniform1i(this._draw_modeLocation, this._lastMode);
|
|
134
|
-
gl.uniform1f(this._edgeCountLocation, this._lastEdgeCount);
|
|
135
|
-
gl.uniform1f(this._plugin_alpha_multiplierLocation, 1.0);
|
|
136
|
-
this.cameraBlockBindingPoint = 0;
|
|
137
|
-
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
138
|
-
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
139
|
-
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
140
|
-
gl.useProgram(currentProgram);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
draw(length, vao, edgeCount, alphaMultiplier, drawMode) {
|
|
144
|
-
const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
|
|
145
|
-
// gl.disable(gl.DEPTH_TEST);
|
|
146
|
-
gl.useProgram(program);
|
|
147
|
-
if (drawMode !== this._lastMode) {
|
|
148
|
-
gl.uniform1i(this._draw_modeLocation, drawModeMap[drawMode]);
|
|
149
|
-
this._lastMode = drawMode;
|
|
150
|
-
}
|
|
151
|
-
if (edgeCount !== this._lastEdgeCount) {
|
|
152
|
-
gl.uniform1f(this._edgeCountLocation, edgeCount);
|
|
153
|
-
this._lastEdgeCount = edgeCount;
|
|
154
|
-
}
|
|
155
|
-
if (alphaMultiplier !== this._lastAlphaMultiplier) {
|
|
156
|
-
gl.uniform1f(this._plugin_alpha_multiplierLocation, alphaMultiplier);
|
|
157
|
-
this._lastAlphaMultiplier = alphaMultiplier;
|
|
158
|
-
}
|
|
159
|
-
const overdraw = drawModeMap[drawMode];
|
|
160
|
-
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
161
|
-
gl.bindVertexArray(vao);
|
|
162
|
-
gl.drawArraysInstanced(gl[drawMode], 0, edgeCount + overdraw, length);
|
|
163
|
-
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
164
|
-
gl.bindVertexArray(null);
|
|
165
|
-
// gl.enable(gl.DEPTH_TEST);
|
|
166
|
-
}
|
|
167
|
-
free() {
|
|
168
|
-
noRegisterGlobeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
|
|
169
|
-
this.gl.deleteProgram(this.program);
|
|
170
|
-
this.program = null;
|
|
171
|
-
}
|
|
172
|
-
getVaoBuffer() {
|
|
173
|
-
const { gl } = this;
|
|
174
|
-
const vao = gl.createVertexArray();
|
|
175
|
-
const buffer = gl.createBuffer();
|
|
176
|
-
gl.bindVertexArray(vao);
|
|
177
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
178
|
-
const stride = ITEM_SIZE * 4;
|
|
179
|
-
let offset = 0;
|
|
180
|
-
gl.enableVertexAttribArray(0);
|
|
181
|
-
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
|
|
182
|
-
offset += 2 * 4;
|
|
183
|
-
gl.enableVertexAttribArray(1);
|
|
184
|
-
gl.vertexAttribPointer(1, 1, gl.FLOAT, false, stride, offset);
|
|
185
|
-
offset += 1 * 4;
|
|
186
|
-
gl.enableVertexAttribArray(2);
|
|
187
|
-
gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
|
|
188
|
-
offset += 1 * 4;
|
|
189
|
-
gl.enableVertexAttribArray(3);
|
|
190
|
-
gl.vertexAttribPointer(3, 4, gl.FLOAT, false, stride, offset);
|
|
191
|
-
offset += 4 * 4;
|
|
192
|
-
gl.enableVertexAttribArray(4);
|
|
193
|
-
gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
|
|
194
|
-
offset += 1 * 4;
|
|
195
|
-
gl.enableVertexAttribArray(5);
|
|
196
|
-
gl.vertexAttribPointer(5, 1, gl.FLOAT, false, stride, offset);
|
|
197
|
-
gl.vertexAttribDivisor(0, 1);
|
|
198
|
-
gl.vertexAttribDivisor(1, 1);
|
|
199
|
-
gl.vertexAttribDivisor(2, 1);
|
|
200
|
-
gl.vertexAttribDivisor(3, 1);
|
|
201
|
-
gl.vertexAttribDivisor(4, 1);
|
|
202
|
-
gl.vertexAttribDivisor(5, 1);
|
|
203
|
-
gl.bindVertexArray(null);
|
|
204
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
205
|
-
return {
|
|
206
|
-
vao,
|
|
207
|
-
buffer,
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* in vec2 center; // long, lat in radian
|
|
212
|
-
in float start_angle; // the start of partial circle from bearing point
|
|
213
|
-
in float tail_angle; // the rotation of the partial circle
|
|
214
|
-
in vec4 color;
|
|
215
|
-
in float radius; // in meter
|
|
216
|
-
in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
|
|
217
|
-
*/
|
|
218
|
-
createVAO(centerObj, startAngleObj, tailAngleObj, colorObj, radiusObj, colorModeObj) {
|
|
219
|
-
const { gl } = this;
|
|
220
|
-
const vao = gl.createVertexArray();
|
|
221
|
-
gl.bindVertexArray(vao);
|
|
222
|
-
{
|
|
223
|
-
const { buffer, stride, offset } = centerObj;
|
|
224
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
225
|
-
gl.enableVertexAttribArray(0);
|
|
226
|
-
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
|
|
227
|
-
gl.vertexAttribDivisor(0, 1);
|
|
228
|
-
}
|
|
229
|
-
{
|
|
230
|
-
const { buffer, stride, offset } = startAngleObj;
|
|
231
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
232
|
-
gl.enableVertexAttribArray(1);
|
|
233
|
-
gl.vertexAttribPointer(1, 1, gl.FLOAT, false, stride, offset);
|
|
234
|
-
gl.vertexAttribDivisor(1, 1);
|
|
235
|
-
}
|
|
236
|
-
{
|
|
237
|
-
const { buffer, stride, offset } = tailAngleObj;
|
|
238
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
239
|
-
gl.enableVertexAttribArray(2);
|
|
240
|
-
gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
|
|
241
|
-
gl.vertexAttribDivisor(2, 1);
|
|
242
|
-
}
|
|
243
|
-
{
|
|
244
|
-
const { buffer, stride, offset } = colorObj;
|
|
245
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
246
|
-
gl.enableVertexAttribArray(3);
|
|
247
|
-
gl.vertexAttribPointer(3, 4, gl.FLOAT, false, stride, offset);
|
|
248
|
-
gl.vertexAttribDivisor(3, 1);
|
|
249
|
-
}
|
|
250
|
-
{
|
|
251
|
-
const { buffer, stride, offset } = radiusObj;
|
|
252
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
253
|
-
gl.enableVertexAttribArray(4);
|
|
254
|
-
gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
|
|
255
|
-
gl.vertexAttribDivisor(4, 1);
|
|
256
|
-
}
|
|
257
|
-
{
|
|
258
|
-
const { buffer, stride, offset } = colorModeObj;
|
|
259
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
260
|
-
gl.enableVertexAttribArray(5);
|
|
261
|
-
gl.vertexAttribPointer(5, 1, gl.FLOAT, false, stride, offset);
|
|
262
|
-
gl.vertexAttribDivisor(5, 1);
|
|
263
|
-
}
|
|
264
|
-
gl.bindVertexArray(null);
|
|
265
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
266
|
-
return vao;
|
|
267
|
-
}
|
|
268
|
-
getBufferManagerAndVao({ capacity = 10, bufferType = "DYNAMIC_DRAW" } = {}) {
|
|
269
|
-
const { vao, buffer } = this.getVaoBuffer();
|
|
270
|
-
return {
|
|
271
|
-
bufferManager: new BufferManager(this.globe, this.gl, buffer, { capacity, bufferType }),
|
|
272
|
-
vao
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
export const programCache = Object.freeze({
|
|
277
|
-
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
278
|
-
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
279
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
2
|
-
class IsGlobeMoved {
|
|
3
|
-
constructor(globe) {
|
|
4
|
-
this.globe = globe;
|
|
5
|
-
this._lastLOD = globe.api_GetCurrentLODWithDecimal();
|
|
6
|
-
}
|
|
7
|
-
isMoved() {
|
|
8
|
-
const globe = this.globe;
|
|
9
|
-
if (globe.api_IsScreenMoving() || this._lastLOD != globe.api_GetCurrentLODWithDecimal()) {
|
|
10
|
-
this._lastLOD = globe.api_GetCurrentLODWithDecimal();
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const IsGlobeMovedCache = Object.freeze({
|
|
17
|
-
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, IsGlobeMoved),
|
|
18
|
-
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, IsGlobeMoved)
|
|
19
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { glProgramCache } from "../../programcache";
|
|
2
|
-
import FadeAwayProgram from "./logic";
|
|
3
|
-
export default class FadeAway {
|
|
4
|
-
constructor(gl) {
|
|
5
|
-
this.gl = gl;
|
|
6
|
-
this.program = glProgramCache.getProgram(gl, FadeAwayProgram);
|
|
7
|
-
}
|
|
8
|
-
draw(sourceTexture, opacity) {
|
|
9
|
-
this.program.draw(sourceTexture, opacity);
|
|
10
|
-
}
|
|
11
|
-
free() {
|
|
12
|
-
glProgramCache.releaseProgram(FadeAwayProgram);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// TODO: Delete this file if it is not needed anymore.
|
|
3
|
-
// import { createProgram, shaderfunctions } from "../../../util";
|
|
4
|
-
// import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
|
|
5
|
-
// import { noRegisterGlobeProgramCache, globeProgramCache } from "../../programcache";
|
|
6
|
-
// const CIRCLE_EDGE_COUNT = 360;
|
|
7
|
-
// const vertexShader = `#version 300 es ` +
|
|
8
|
-
// shaderfunctions.PI +
|
|
9
|
-
// shaderfunctions.R +
|
|
10
|
-
// shaderfunctions.POLE +
|
|
11
|
-
// CameraUniformBlockString +
|
|
12
|
-
// shaderfunctions.mercatorXYToGLPosition +
|
|
13
|
-
// shaderfunctions.longLatRadToMercator +
|
|
14
|
-
// shaderfunctions.longLatRadToCartesian3D +
|
|
15
|
-
// shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
16
|
-
// shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
17
|
-
// shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
18
|
-
// uniform int compass;
|
|
19
|
-
// uniform float circle_edge_count;
|
|
20
|
-
// uniform float opacity;
|
|
21
|
-
// in vec2 center;
|
|
22
|
-
// in float radius;
|
|
23
|
-
// in vec4 color;
|
|
24
|
-
// in float flag;
|
|
25
|
-
// out vec4 v_color;
|
|
26
|
-
// out vec2 v_limp;
|
|
27
|
-
// void main() {
|
|
28
|
-
// if( flag == 1.0 || radius == 0.0) return; // flag 1.0 is hide
|
|
29
|
-
// v_color = vec4(color.rgb, color.a * opacity);
|
|
30
|
-
// if ( gl_VertexID == 270 ) v_color.rgb += 0.2;
|
|
31
|
-
// float angle = 3.1415926535897932384626433832795 * 2.0 * (float(gl_VertexID) / circle_edge_count);
|
|
32
|
-
// if ( is3D ){
|
|
33
|
-
// gl_Position = projection * view * vec4(
|
|
34
|
-
// circleLimpFromLongLatRadCenterCartesian3D( center, radius, angle) - translate, 1.0);
|
|
35
|
-
// v_limp = vec2(0.0, 0.0);
|
|
36
|
-
// return;
|
|
37
|
-
// }
|
|
38
|
-
// vec2 limp;
|
|
39
|
-
// if ( compass == 1 ){
|
|
40
|
-
// limp = circleLimpFromLongLatRadCenterMercatorCompass(center, radius, angle);
|
|
41
|
-
// } else {
|
|
42
|
-
// limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius, angle);
|
|
43
|
-
// }
|
|
44
|
-
// v_limp = limp;
|
|
45
|
-
// gl_Position = mercatorXYToGLPosition(limp);
|
|
46
|
-
// }`;
|
|
47
|
-
// const fragmentShader = `#version 300 es
|
|
48
|
-
// precision highp float;` +
|
|
49
|
-
// shaderfunctions.POLE + `
|
|
50
|
-
// in vec4 v_color;
|
|
51
|
-
// in vec2 v_limp;
|
|
52
|
-
// out vec4 outColor;
|
|
53
|
-
// void main() {
|
|
54
|
-
// if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
|
|
55
|
-
// outColor = v_color;
|
|
56
|
-
// }`;
|
|
57
|
-
// class Logic {
|
|
58
|
-
// constructor(globe) {
|
|
59
|
-
// this.globe = globe;
|
|
60
|
-
// this.gl = globe.gl;
|
|
61
|
-
// this.program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
62
|
-
// { // bind positions so bufferManager can use them
|
|
63
|
-
// this.gl.bindAttribLocation(this.program, 0, "center");
|
|
64
|
-
// this.gl.bindAttribLocation(this.program, 1, "radius");
|
|
65
|
-
// this.gl.bindAttribLocation(this.program, 2, "color");
|
|
66
|
-
// this.gl.bindAttribLocation(this.program, 3, "flag");
|
|
67
|
-
// }
|
|
68
|
-
// this.cameraBlockBindingPoint = 0;
|
|
69
|
-
// this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
70
|
-
// const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
71
|
-
// this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
72
|
-
// this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
73
|
-
// this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
74
|
-
// this._circleEdgeCountLocation = this.gl.getUniformLocation(this.program, "circle_edge_count");
|
|
75
|
-
// this._circleEdgeCount = CIRCLE_EDGE_COUNT;
|
|
76
|
-
// this._compassmode = 1;
|
|
77
|
-
// this._opacity = 1.0;
|
|
78
|
-
// {
|
|
79
|
-
// const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
80
|
-
// this.gl.useProgram(this.program);
|
|
81
|
-
// this.gl.uniform1i(this._compassLocation, 1);
|
|
82
|
-
// this.gl.uniform1f(this._circleEdgeCountLocation, CIRCLE_EDGE_COUNT);
|
|
83
|
-
// this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
84
|
-
// this.gl.useProgram(currentProgram);
|
|
85
|
-
// }
|
|
86
|
-
// }
|
|
87
|
-
// draw(attrBufferManager, compass, circleEdgeCount, opacity) {
|
|
88
|
-
// const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
|
|
89
|
-
// gl.useProgram(program);
|
|
90
|
-
// cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
91
|
-
// attrBufferManager.bindCircleVAO();
|
|
92
|
-
// if (compass !== this._compassmode) {
|
|
93
|
-
// gl.uniform1i(this._compassLocation, compass);
|
|
94
|
-
// this._compassmode = compass;
|
|
95
|
-
// }
|
|
96
|
-
// if (opacity !== this._opacity) {
|
|
97
|
-
// gl.uniform1f(this._opacityLocation, opacity);
|
|
98
|
-
// this._opacity = opacity;
|
|
99
|
-
// }
|
|
100
|
-
// if (circleEdgeCount !== this._circleEdgeCount) {
|
|
101
|
-
// gl.uniform1f(this._circleEdgeCountLocation, circleEdgeCount);
|
|
102
|
-
// this._circleEdgeCount = circleEdgeCount;
|
|
103
|
-
// }
|
|
104
|
-
// gl.drawArraysInstanced(gl.LINE_LOOP, 0, circleEdgeCount, attrBufferManager.length);
|
|
105
|
-
// gl.bindVertexArray(null);
|
|
106
|
-
// cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
107
|
-
// }
|
|
108
|
-
// free() {
|
|
109
|
-
// this.gl.deleteProgram(this.program);
|
|
110
|
-
// globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
|
|
111
|
-
// }
|
|
112
|
-
// }
|
|
113
|
-
// export const programCache = Object.freeze({
|
|
114
|
-
// getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
|
|
115
|
-
// releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
|
|
116
|
-
// });
|