@pirireis/webglobeplugins 0.9.6 → 0.9.7
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/package.json +5 -2
- package/Math/angle-calculation.js +0 -14
- package/Math/arc.ts +0 -76
- package/Math/bounds/line-bbox.js +0 -225
- package/Math/constants.ts +0 -11
- package/Math/frustum/camera.ts +0 -32
- package/Math/frustum/from-globeinfo.ts +0 -63
- package/Math/frustum/types.ts +0 -11
- package/Math/globe-util/horizon-plane.ts +0 -137
- package/Math/index.js +0 -0
- package/Math/juction/arc-plane.ts +0 -114
- package/Math/juction/line-sphere.ts +0 -30
- package/Math/juction/plane-plane.ts +0 -66
- package/Math/line.ts +0 -70
- package/Math/matrix4.ts +0 -0
- package/Math/methods.js +0 -237
- package/Math/plane.ts +0 -86
- package/Math/quaternion.ts +0 -120
- package/Math/roadmap.md +0 -10
- package/Math/types.ts +0 -45
- package/Math/utils.js +0 -3
- package/Math/vec3.ts +0 -155
- package/algorithms/search-binary.js +0 -14
- package/altitude-locator/adaptors.js +0 -0
- package/altitude-locator/draw-subset-obj.js +0 -27
- package/altitude-locator/keymethod.js +0 -0
- package/altitude-locator/plugin.js +0 -439
- package/altitude-locator/types.js +0 -26
- package/arrowfield/adaptor.js +0 -11
- package/arrowfield/index.js +0 -3
- package/arrowfield/plugin.js +0 -128
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -512
- package/circle-line-chain/chain-list-map.js +0 -221
- package/circle-line-chain/init.js +0 -0
- package/circle-line-chain/plugin.js +0 -469
- package/circle-line-chain/readme.md +0 -57
- package/circle-line-chain/util.js +0 -1
- package/compass-rose/compass-rose-padding-flat.js +0 -266
- package/compass-rose/compass-text-writer.js +0 -173
- package/compass-rose/index.js +0 -3
- package/compassrose/compassrose.js +0 -341
- package/compassrose/index.js +0 -2
- package/depth-locator/readme.md +0 -26
- package/globe-types.ts +0 -13
- package/heatwave/index.js +0 -4
- package/heatwave/isobar/objectarraylabels.js +0 -247
- package/heatwave/isobar/plugin.js +0 -340
- package/heatwave/isobar/quadtreecontours.js +0 -336
- package/heatwave/plugins/heatwaveglobeshell.js +0 -258
- package/jest.config.js +0 -6
- package/partialrings/buffer-manager.js +0 -89
- package/partialrings/goals.md +0 -17
- package/partialrings/index.js +0 -3
- package/partialrings/plugin.js +0 -160
- package/partialrings/program.js +0 -324
- package/pin/pin-object-array.js +0 -381
- package/pin/pin-point-totem.js +0 -77
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
- package/point-heat-map/index.js +0 -0
- package/point-heat-map/plugin-webworker.js +0 -151
- package/point-heat-map/point-to-heat-map-flow.js +0 -150
- package/point-heat-map/readme.md +0 -15
- package/point-tracks/key-methods.js +0 -3
- package/point-tracks/plugin.js +0 -394
- package/programs/arrowfield/index.js +0 -2
- package/programs/arrowfield/logic.js +0 -286
- package/programs/arrowfield/object.js +0 -89
- package/programs/data2legend/density-to-legend.js +0 -115
- package/programs/data2legend/point-to-density-texture.js +0 -114
- package/programs/float2legendwithratio/index.js +0 -3
- package/programs/float2legendwithratio/logic.js +0 -194
- package/programs/float2legendwithratio/object.js +0 -141
- package/programs/globe-util/is-globe-moved.js +0 -27
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/noise/noises.js +0 -0
- package/programs/globeshell/wiggle/index.js +0 -6
- package/programs/globeshell/wiggle/logic.js +0 -371
- package/programs/globeshell/wiggle/object.js +0 -93
- package/programs/helpers/blender/index.js +0 -0
- package/programs/helpers/blender/program.js +0 -91
- package/programs/helpers/fadeaway/index.js +0 -3
- package/programs/helpers/fadeaway/logic.js +0 -76
- package/programs/helpers/fadeaway/object.js +0 -20
- package/programs/helpers/index.js +0 -2
- package/programs/index.js +0 -21
- package/programs/interface.ts +0 -7
- package/programs/line-on-globe/angled-line.js +0 -206
- package/programs/line-on-globe/circle-accurate-3d.js +0 -167
- package/programs/line-on-globe/circle-accurate-flat.js +0 -262
- package/programs/line-on-globe/circle-accurate.js +0 -202
- package/programs/line-on-globe/circle.js +0 -191
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
- package/programs/line-on-globe/index.js +0 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
- package/programs/line-on-globe/linestrip.ts +0 -228
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
- package/programs/line-on-globe/to-the-surface.js +0 -129
- package/programs/line-on-globe/util.js +0 -8
- package/programs/picking/pickable-renderer.js +0 -216
- package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
- package/programs/point-on-globe/element-point-glow.js +0 -184
- package/programs/point-on-globe/square-pixel-point.js +0 -189
- package/programs/programcache.ts +0 -131
- package/programs/rings/distancering/circleflatprogram.js +0 -136
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
- package/programs/rings/distancering/index.js +0 -5
- package/programs/rings/distancering/paddyflatprogram.js +0 -146
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
- package/programs/rings/distancering/shader.js +0 -0
- package/programs/rings/index.js +0 -1
- package/programs/rings/partial-ring/piece-of-pie.js +0 -315
- package/programs/totems/camerauniformblock.d.ts +0 -48
- package/programs/totems/camerauniformblock.js +0 -197
- package/programs/totems/canvas-webglobe-info.js +0 -136
- package/programs/totems/gpu-selection-uniform-block.js +0 -132
- package/programs/totems/index.ts +0 -2
- package/programs/two-d/pixel-circle.js +0 -0
- package/programs/two-d/pixel-padding-for-compass.js +0 -174
- package/programs/util.js +0 -20
- package/programs/vectorfields/index.js +0 -3
- package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
- package/programs/vectorfields/logics/index.js +0 -5
- package/programs/vectorfields/logics/pixelbased.js +0 -161
- package/programs/vectorfields/logics/ubo.js +0 -64
- package/programs/vectorfields/pingpongbuffermanager.js +0 -80
- package/publish.bat +0 -60
- package/rangerings/enum.js +0 -3
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -649
- package/rangerings/rangeringangletext.js +0 -368
- package/rangerings/ring-account.js +0 -129
- package/shaders/fragment-toy/firework.js +0 -55
- package/shaders/fragment-toy/singularity.js +0 -59
- package/shape-on-terrain/arc/naive/plugin.ts +0 -304
- package/shape-on-terrain/goal.md +0 -12
- package/tests/Math/junction/arc-plane.test.ts +0 -133
- package/tests/Math/junction/plane-plane.test.ts +0 -82
- package/tests/Math/plane.test.ts +0 -43
- package/tests/Math/vec3.test.ts +0 -14
- package/timetracks/adaptors-line-strip.js +0 -80
- package/timetracks/adaptors.js +0 -133
- package/timetracks/index.js +0 -6
- package/timetracks/plugin-line-strip.js +0 -295
- package/timetracks/plugin.js +0 -304
- package/timetracks/program-line-strip.js +0 -688
- package/timetracks/program.js +0 -850
- package/timetracks/programpoint-line-strip.js +0 -175
- package/timetracks/programpoint.js +0 -168
- package/timetracks/readme.md +0 -1
- package/tsconfig.json +0 -22
- package/types.ts +0 -17
- package/util/account/bufferoffsetmanager.js +0 -209
- package/util/account/index.js +0 -6
- package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
- package/util/account/single-attribute-buffer-management/index.ts +0 -13
- package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
- package/util/account/single-attribute-buffer-management/types.ts +0 -39
- package/util/account/util.js +0 -22
- package/util/algorithms/index.js +0 -0
- package/util/algorithms/search-binary.js +0 -26
- package/util/check/get.js +0 -13
- package/util/check/index.js +0 -0
- package/util/check/typecheck.js +0 -39
- package/util/geometry/index.js +0 -53
- package/util/gl-util/buffer/attribute-loader.ts +0 -85
- package/util/gl-util/buffer/index.ts +0 -6
- package/util/gl-util/buffer/types.ts +0 -13
- package/util/gl-util/draw-options/methods.ts +0 -66
- package/util/gl-util/draw-options/types.ts +0 -28
- package/util/gl-util/uniform-block/manager.ts +0 -187
- package/util/gl-util/uniform-block/roadmap.md +0 -70
- package/util/gl-util/uniform-block/shader.js +0 -0
- package/util/gl-util/uniform-block/types.ts +0 -27
- package/util/heatwavedatamanager/datamanager.js +0 -168
- package/util/heatwavedatamanager/index.js +0 -3
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/index.js +0 -13
- package/util/interpolation/index.js +0 -0
- package/util/interpolation/timetrack/index.js +0 -9
- package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
- package/util/interpolation/timetrack/web-worker-str.js +0 -180
- package/util/interpolation/timetrack/web-worker.js +0 -51
- package/util/jshelpers/data-filler.js +0 -19
- package/util/jshelpers/equality.js +0 -17
- package/util/jshelpers/index.js +0 -1
- package/util/jshelpers/timefilters.js +0 -32
- package/util/picking/fence.js +0 -46
- package/util/picking/picker-displayer.js +0 -177
- package/util/programs/draw-texture-on-canvas.js +0 -102
- package/util/programs/index.js +0 -1
- package/util/programs/shapesonglobe.js +0 -246
- package/util/programs/supersampletotextures.js +0 -142
- package/util/programs/texturetoglobe.js +0 -203
- package/util/shaderfunctions/geometrytransformations.ts +0 -388
- package/util/shaderfunctions/index.js +0 -2
- package/util/shaderfunctions/nodata.js +0 -10
- package/util/shaderfunctions/noisefunctions.js +0 -44
- package/util/surface-line-data/arc-bboxes.ts +0 -42
- package/util/surface-line-data/arcs-to-cuts.js +0 -74
- package/util/surface-line-data/cut-arc.js +0 -0
- package/util/surface-line-data/flow.ts +0 -52
- package/util/surface-line-data/rbush-manager.js +0 -0
- package/util/surface-line-data/types.ts +0 -27
- package/util/surface-line-data/web-worker.js +0 -0
- package/util/webglobe/gldefaultstates.js +0 -5
- package/util/webglobe/index.js +0 -2
- package/util/webglobe/rasteroverlay.js +0 -96
- package/util/webglobjectbuilders.ts +0 -456
- package/util/webglobjectbuilders1.js +0 -271
- package/waveparticles/adaptor.js +0 -16
- package/waveparticles/index.js +0 -3
- package/waveparticles/plugin.js +0 -313
- package/wind/imagetovectorfieldandmagnitude.js +0 -39
- package/wind/index.js +0 -5
- package/wind/plugin.js +0 -1057
- package/wind/vectorfieldimage.js +0 -27
- package/write-text/attached-text-writer.js +0 -105
- package/write-text/context-text.js +0 -125
- package/write-text/context-text3.js +0 -178
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -7
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { createProgram } from "../webglobjectbuilders";
|
|
2
|
-
import { glProgramCache } from "../../programs";
|
|
3
|
-
// import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../../programs/totems";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const vs = `#version 300 es
|
|
7
|
-
precision highp float;
|
|
8
|
-
|
|
9
|
-
in vec2 a_position;
|
|
10
|
-
out vec2 v_texcoord;
|
|
11
|
-
|
|
12
|
-
void main() {
|
|
13
|
-
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
14
|
-
v_texcoord = a_position * 0.5 + 0.5;
|
|
15
|
-
}`;
|
|
16
|
-
|
|
17
|
-
const fs = `#version 300 es
|
|
18
|
-
precision highp float;
|
|
19
|
-
|
|
20
|
-
uniform sampler2D u_texture;
|
|
21
|
-
uniform float u_opacity;
|
|
22
|
-
in vec2 v_texcoord;
|
|
23
|
-
out vec4 fragColor;
|
|
24
|
-
|
|
25
|
-
void main() {
|
|
26
|
-
fragColor = texture(u_texture, v_texcoord);
|
|
27
|
-
fragColor.a *= u_opacity;
|
|
28
|
-
}`;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class TextureOnCanvasProgram {
|
|
33
|
-
constructor(gl) {
|
|
34
|
-
this.gl = gl;
|
|
35
|
-
|
|
36
|
-
this.vao = this.gl.createVertexArray();
|
|
37
|
-
this.buffer = this.gl.createBuffer();
|
|
38
|
-
this.gl.bindVertexArray(this.vao);
|
|
39
|
-
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.buffer);
|
|
40
|
-
this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array([
|
|
41
|
-
-1, -1,
|
|
42
|
-
1, -1,
|
|
43
|
-
1, 1,
|
|
44
|
-
-1, 1
|
|
45
|
-
]), this.gl.STATIC_DRAW);
|
|
46
|
-
this.gl.enableVertexAttribArray(0);
|
|
47
|
-
this.gl.vertexAttribPointer(0, 2, this.gl.FLOAT, false, 0, 0);
|
|
48
|
-
this.gl.bindVertexArray(null);
|
|
49
|
-
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null);
|
|
50
|
-
|
|
51
|
-
this.program = createProgram(this.gl, vs, fs);
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
const { gl, program } = this;
|
|
55
|
-
this.uniforms = {
|
|
56
|
-
texture: gl.getUniformLocation(program, "u_texture"),
|
|
57
|
-
opacity: gl.getUniformLocation(program, "u_opacity"),
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
{
|
|
61
|
-
this._lastOpacity = 1.0;
|
|
62
|
-
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
63
|
-
this.gl.useProgram(this.program);
|
|
64
|
-
this.gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
|
|
65
|
-
this.gl.useProgram(currentProgram);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
draw(texture, { opacity = 1.0 } = {}) {
|
|
71
|
-
|
|
72
|
-
const { gl, program, uniforms, vao } = this;
|
|
73
|
-
gl.useProgram(program);
|
|
74
|
-
gl.bindVertexArray(vao);
|
|
75
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
76
|
-
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
77
|
-
gl.uniform1i(uniforms.texture, 0);
|
|
78
|
-
if (this._lastOpacity !== opacity) {
|
|
79
|
-
gl.uniform1f(uniforms.opacity, opacity);
|
|
80
|
-
this._lastOpacity = opacity;
|
|
81
|
-
}
|
|
82
|
-
gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
|
|
83
|
-
gl.bindVertexArray(null);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
free() {
|
|
87
|
-
if (this._isFreed) return;
|
|
88
|
-
this.gl.deleteVertexArray(this.vao);
|
|
89
|
-
this.gl.deleteBuffer(this.buffer);
|
|
90
|
-
this.gl.deleteProgram(this.program);
|
|
91
|
-
this._isFreed = true;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const textureOnCanvasProgramCache = Object.freeze({
|
|
97
|
-
get: (gl) => glProgramCache.getProgram(gl, TextureOnCanvasProgram),
|
|
98
|
-
release: (gl) => glProgramCache.releaseProgram(gl, TextureOnCanvasProgram)
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
export { textureOnCanvasProgramCache };
|
package/util/programs/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./shapesonglobe";
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { createProgram } from "../webglobjectbuilders";
|
|
2
|
-
import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../../programs/totems/camerauniformblock";
|
|
3
|
-
import { shaderfunctions } from "..";
|
|
4
|
-
/** TODO:
|
|
5
|
-
* 3d icin calistir
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const drawModeFunc = (gl) => {
|
|
9
|
-
return (mode) => {
|
|
10
|
-
return {
|
|
11
|
-
"point": gl.POINTS,
|
|
12
|
-
"line": gl.LINES,
|
|
13
|
-
"line_strip": gl.LINE_STRIP,
|
|
14
|
-
"line_loop": gl.LINE_LOOP,
|
|
15
|
-
"triangle": gl.TRIANGLES,
|
|
16
|
-
"triangle_strip": gl.TRIANGLE_STRIP,
|
|
17
|
-
"triangle_fan": gl.TRIANGLE_FAN
|
|
18
|
-
}[mode];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export class ShapesOnGlobeProgram {
|
|
25
|
-
constructor(gl, globe, drawMode = 'point') {
|
|
26
|
-
this.globe = globe;
|
|
27
|
-
this.gl = gl;
|
|
28
|
-
this._getDraw = drawModeFunc(gl);
|
|
29
|
-
this._drawMode = this._getDraw(drawMode);
|
|
30
|
-
this._is3D = true;
|
|
31
|
-
this._inBuffer = gl.createBuffer();
|
|
32
|
-
|
|
33
|
-
this._programWrapper = this._createProgramWrapper();
|
|
34
|
-
this._initUniforms();
|
|
35
|
-
|
|
36
|
-
this.setScreenWH();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
_initUniforms() {
|
|
40
|
-
|
|
41
|
-
const { gl, _programWrapper } = this;
|
|
42
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
43
|
-
this._getDrawMode = drawModeFunc(gl);
|
|
44
|
-
|
|
45
|
-
gl.useProgram(_programWrapper.program);
|
|
46
|
-
gl.uniform1f(_programWrapper.u_opacity, 1.0);
|
|
47
|
-
gl.uniform1f(_programWrapper.u_is3D, 1.0);
|
|
48
|
-
gl.uniform1f(_programWrapper.height, 0.0);
|
|
49
|
-
gl.uniform1f(_programWrapper.u_point_size, 1.0);
|
|
50
|
-
gl.useProgram(currentProgram);
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
_createProgramWrapper() {
|
|
55
|
-
const { gl, globe } = this;
|
|
56
|
-
const vertexSource = `#version 300 es
|
|
57
|
-
precision highp float;
|
|
58
|
-
${CameraUniformBlockString}
|
|
59
|
-
|
|
60
|
-
in vec2 a_position;
|
|
61
|
-
in vec4 a_color;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
uniform bool u_is3D;
|
|
65
|
-
uniform float height;
|
|
66
|
-
|
|
67
|
-
uniform float u_point_size;
|
|
68
|
-
|
|
69
|
-
out vec4 v_color;
|
|
70
|
-
|
|
71
|
-
` + shaderfunctions.pixelXYToCartesian3DPoint + `
|
|
72
|
-
` + shaderfunctions.pixelXYToCartesian2DPoint + `
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
void main() {
|
|
76
|
-
vec3 pos = vec3(a_position, height);
|
|
77
|
-
if(is3D){
|
|
78
|
-
pos = pixelXYToCartesian3DPoint(pos);
|
|
79
|
-
gl_Position = projection * view * vec4(pos - translate, 1.0);
|
|
80
|
-
} else {
|
|
81
|
-
vec2 xy = pixelXYToCartesian2DPoint(pos.xy, translate.xy, mapWH, screenWH);
|
|
82
|
-
gl_Position = projection * vec4(xy.x, xy.y, 0.0, 1.0);
|
|
83
|
-
}
|
|
84
|
-
gl_PointSize = u_point_size;
|
|
85
|
-
v_color = a_color;
|
|
86
|
-
}
|
|
87
|
-
`;
|
|
88
|
-
|
|
89
|
-
const fragmentSource = `#version 300 es
|
|
90
|
-
precision highp float;
|
|
91
|
-
|
|
92
|
-
uniform float u_opacity;
|
|
93
|
-
|
|
94
|
-
in vec4 v_color;
|
|
95
|
-
out vec4 outColor;
|
|
96
|
-
|
|
97
|
-
void main() {
|
|
98
|
-
outColor = v_color;
|
|
99
|
-
outColor.a = u_opacity;
|
|
100
|
-
}
|
|
101
|
-
`;
|
|
102
|
-
|
|
103
|
-
const program = createProgram(gl, vertexSource, fragmentSource);
|
|
104
|
-
|
|
105
|
-
const a_position = gl.getAttribLocation(program, 'a_position');
|
|
106
|
-
const a_color = gl.getAttribLocation(program, 'a_color');
|
|
107
|
-
|
|
108
|
-
// vao and buffer.
|
|
109
|
-
const vao = gl.createVertexArray();
|
|
110
|
-
|
|
111
|
-
gl.bindVertexArray(vao);
|
|
112
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._inBuffer);
|
|
113
|
-
gl.enableVertexAttribArray(a_position);
|
|
114
|
-
gl.vertexAttribPointer(a_position, 2, gl.FLOAT, false, 6 * 4, 0);
|
|
115
|
-
gl.enableVertexAttribArray(a_color);
|
|
116
|
-
gl.vertexAttribPointer(a_color, 4, gl.FLOAT, false, 6 * 4, 2 * 4);
|
|
117
|
-
gl.bindVertexArray(null);
|
|
118
|
-
|
|
119
|
-
const cm = CameraUniformBlockTotemCache.get(globe);
|
|
120
|
-
const bindingPoint = 0;
|
|
121
|
-
const cmIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
122
|
-
gl.uniformBlockBinding(program, cmIndex, bindingPoint);
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
program: program,
|
|
126
|
-
vao: vao,
|
|
127
|
-
u_point_size: gl.getUniformLocation(program, 'u_point_size'),
|
|
128
|
-
u_opacity: gl.getUniformLocation(program, 'u_opacity'),
|
|
129
|
-
bindCamera: () => cm.bind(bindingPoint),
|
|
130
|
-
unbindCamera: () => cm.unbind(bindingPoint)
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
draw(uProjectionMatrix, uModelViewMatrix, uTranslate, drawRanges) {
|
|
137
|
-
const { gl, _programWrapper, _is3D } = this;
|
|
138
|
-
|
|
139
|
-
const deepTest = gl.isEnabled(gl.DEPTH_TEST);
|
|
140
|
-
gl.disable(gl.DEPTH_TEST);
|
|
141
|
-
|
|
142
|
-
gl.useProgram(_programWrapper.program);
|
|
143
|
-
gl.bindVertexArray(_programWrapper.vao);
|
|
144
|
-
gl.uniformMatrix4fv(_programWrapper.u_model_view_matrix, false, uModelViewMatrix);
|
|
145
|
-
gl.uniformMatrix4fv(_programWrapper.u_proj_matrix, false, uProjectionMatrix);
|
|
146
|
-
gl.uniform3f(_programWrapper.u_transpos, uTranslate.x, uTranslate.y, uTranslate.z);
|
|
147
|
-
gl.bindVertexArray(_programWrapper.vao);
|
|
148
|
-
_programWrapper.bindCamera();
|
|
149
|
-
if (!_is3D) {
|
|
150
|
-
const mapWH = this.globe.api_GetCurrentWorldWH();
|
|
151
|
-
gl.uniform2f(_programWrapper.u_mapWH, mapWH.width, mapWH.height);
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
for (const drawRange of drawRanges) {
|
|
156
|
-
gl.drawArrays(this._drawMode, drawRange[0], drawRange[1]);
|
|
157
|
-
// gl.drawArrays(gl.POINTS, drawRange[0], 1);
|
|
158
|
-
}
|
|
159
|
-
_programWrapper.unbindCamera();
|
|
160
|
-
|
|
161
|
-
gl.bindVertexArray(null);
|
|
162
|
-
if (deepTest) {
|
|
163
|
-
gl.enable(gl.DEPTH_TEST);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
setOpacity(opacity) {
|
|
168
|
-
if (opacity < 0 || opacity > 1) {
|
|
169
|
-
throw new Error('Invalid opacity value');
|
|
170
|
-
};
|
|
171
|
-
const { gl, _programWrapper } = this;
|
|
172
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
173
|
-
gl.useProgram(_programWrapper.program);
|
|
174
|
-
gl.uniform1f(_programWrapper.u_opacity, opacity);
|
|
175
|
-
gl.useProgram(currentProgram);
|
|
176
|
-
this.globe.DrawRender();
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
setPointSize(size) {
|
|
180
|
-
const { gl, _programWrapper } = this;
|
|
181
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
182
|
-
gl.useProgram(_programWrapper.program);
|
|
183
|
-
gl.uniform1f(_programWrapper.u_point_size, size);
|
|
184
|
-
gl.useProgram(currentProgram);
|
|
185
|
-
this.globe.DrawRender();
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
setDrawMode(mode) {
|
|
191
|
-
const modegl = this._getDraw(mode);
|
|
192
|
-
if (modegl) {
|
|
193
|
-
this._drawMode = modegl;
|
|
194
|
-
} else {
|
|
195
|
-
throw new Error('Invalid draw mode ' + mode);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
setScreenWH() {
|
|
200
|
-
const { gl, _programWrapper, globe } = this;
|
|
201
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
202
|
-
gl.useProgram(_programWrapper.program);
|
|
203
|
-
gl.uniform2f(_programWrapper.u_scrWH, globe.api_ScrW(), globe.api_ScrH());
|
|
204
|
-
gl.useProgram(currentProgram);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
resize(width, height) {
|
|
209
|
-
const { gl, _programWrapper, globe } = this;
|
|
210
|
-
width = width || globe.api_ScrW();
|
|
211
|
-
height = height || globe.api_ScrH();
|
|
212
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
213
|
-
gl.useProgram(_programWrapper.program);
|
|
214
|
-
gl.uniform2f(_programWrapper.u_scrWH, width, height);
|
|
215
|
-
gl.useProgram(currentProgram);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
setGeometry() {
|
|
219
|
-
const { gl, globe, _programWrapper } = this;
|
|
220
|
-
this._is3D = globe.api_GetCurrentGeometry() === 0;
|
|
221
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
222
|
-
gl.useProgram(_programWrapper.program);
|
|
223
|
-
gl.uniform1f(_programWrapper.u_is3D, this._is3D ? 1.0 : 0.0);
|
|
224
|
-
gl.useProgram(currentProgram);
|
|
225
|
-
this.resize();
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
free() {
|
|
229
|
-
const { gl, _programWrapper } = this;
|
|
230
|
-
gl.deleteProgram(_programWrapper.program);
|
|
231
|
-
gl.deleteVertexArray(_programWrapper.vao);
|
|
232
|
-
gl.deleteBuffer(this._inBuffer);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
*
|
|
238
|
-
* @param {Float32Array} data
|
|
239
|
-
* @format [x, y, r, g, b, a, x, y, r, g, b, a, x, y, r, g, b, a, x, y, r, g, b, a]
|
|
240
|
-
*/
|
|
241
|
-
setBufferData(data) {
|
|
242
|
-
const { gl } = this;
|
|
243
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._inBuffer);
|
|
244
|
-
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import {createProgram} from '../webglobjectbuilders';
|
|
2
|
-
export class SuperSampleTextureProgram{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
constructor(gl, internalFormat = null, sourceFormat = null, sourceType = null, glslOutputType = "float", glslBand = "r"){
|
|
6
|
-
|
|
7
|
-
this._internalFormat = internalFormat || gl.R16F;
|
|
8
|
-
this._sourceFormat = sourceFormat || gl.RED;
|
|
9
|
-
this._sourceType = sourceType || gl.FLOAT;
|
|
10
|
-
|
|
11
|
-
this._glslOutputType = glslOutputType;
|
|
12
|
-
this._glslBand = glslBand;
|
|
13
|
-
|
|
14
|
-
this.gl = gl;
|
|
15
|
-
|
|
16
|
-
this._programWrapper = this._createProgramWrapper();
|
|
17
|
-
|
|
18
|
-
this._framebuffer = this.gl.createFramebuffer();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
_createProgramWrapper(){
|
|
23
|
-
|
|
24
|
-
const {gl, _glslBand, _glslOutputType} = this;
|
|
25
|
-
|
|
26
|
-
const vertexShaderSource =`#version 300 es
|
|
27
|
-
in vec2 a_position;
|
|
28
|
-
out vec2 v_texCoord;
|
|
29
|
-
|
|
30
|
-
uniform mat4 u_bbox_matrix;
|
|
31
|
-
|
|
32
|
-
void main() {
|
|
33
|
-
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
34
|
-
v_texCoord = (u_bbox_matrix * vec4(a_position,0.0, 1.0)).xy;
|
|
35
|
-
}`;
|
|
36
|
-
|
|
37
|
-
const fragmentShaderSource = `#version 300 es
|
|
38
|
-
precision highp float;
|
|
39
|
-
in vec2 v_texCoord;`
|
|
40
|
-
+ `out ${_glslOutputType} outColor;`
|
|
41
|
-
+ `uniform sampler2D u_texture;
|
|
42
|
-
void main() {`
|
|
43
|
-
+ ` outColor = texture(u_texture, v_texCoord).${_glslBand};`
|
|
44
|
-
+ `}`;
|
|
45
|
-
|
|
46
|
-
const program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
|
|
47
|
-
const vao = gl.createVertexArray();
|
|
48
|
-
const positionBuffer = gl.createBuffer();
|
|
49
|
-
gl.bindVertexArray(vao);
|
|
50
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
|
|
51
|
-
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
52
|
-
-1, -1,
|
|
53
|
-
1, -1,
|
|
54
|
-
1, 1,
|
|
55
|
-
-1, 1
|
|
56
|
-
]), gl.STATIC_DRAW);
|
|
57
|
-
gl.enableVertexAttribArray(0);
|
|
58
|
-
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
|
|
59
|
-
gl.bindVertexArray(null);
|
|
60
|
-
|
|
61
|
-
const u_bbox_matrix = gl.getUniformLocation(program, "u_bbox_matrix");
|
|
62
|
-
|
|
63
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
64
|
-
gl.uniformMatrix2fv(u_bbox_matrix, false, new Float32Array([
|
|
65
|
-
1, 0, 0, 0,
|
|
66
|
-
0, 1, 0, 0,
|
|
67
|
-
0, 0, 1, 0,
|
|
68
|
-
0, 0, 0, 1
|
|
69
|
-
]));
|
|
70
|
-
gl.useProgram(program);
|
|
71
|
-
gl.useProgram(currentProgram);
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
program,
|
|
75
|
-
vao,
|
|
76
|
-
u_texture: gl.getUniformLocation(program, "u_texture"),
|
|
77
|
-
u_bbox_matrix
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
createHigherResolutionTexture(targetWidth, targetHeight, sourceTexture){
|
|
83
|
-
|
|
84
|
-
// save current state
|
|
85
|
-
const {gl, _internalFormat, _sourceFormat, _sourceType} = this;
|
|
86
|
-
|
|
87
|
-
const currentViewport = gl.getParameter(gl.VIEWPORT);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const resultTexture = gl.createTexture();
|
|
91
|
-
|
|
92
|
-
gl.bindTexture(gl.TEXTURE_2D, resultTexture);
|
|
93
|
-
gl.texImage2D(gl.TEXTURE_2D, 0, _internalFormat, targetWidth, targetHeight, 0, _sourceFormat, _sourceType, null);
|
|
94
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
95
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
96
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
97
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
98
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);
|
|
99
|
-
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, resultTexture, 0);
|
|
100
|
-
gl.viewport(0, 0, targetWidth, targetHeight);
|
|
101
|
-
gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
|
|
102
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
103
|
-
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
104
|
-
|
|
105
|
-
this._draw(sourceTexture);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// restore previous state
|
|
109
|
-
this.gl.viewport(currentViewport[0], currentViewport[1], currentViewport[2], currentViewport[3]);
|
|
110
|
-
|
|
111
|
-
return resultTexture;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
_draw(texture){
|
|
116
|
-
|
|
117
|
-
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
118
|
-
this.gl.useProgram(this._programWrapper.program);
|
|
119
|
-
this.gl.bindVertexArray(this._programWrapper.vao);
|
|
120
|
-
this.gl.activeTexture(this.gl.TEXTURE0);
|
|
121
|
-
this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
|
|
122
|
-
this.gl.uniform1i(this._programWrapper.u_texture, 0);
|
|
123
|
-
this.gl.drawArrays(this.gl.TRIANGLE_FAN, 0, 4);
|
|
124
|
-
this.gl.bindVertexArray(null);
|
|
125
|
-
this.gl.useProgram(currentProgram);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
setBBox(x0, y0, x1, y1){
|
|
130
|
-
const {gl, _programWrapper} = this;
|
|
131
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
132
|
-
gl.useProgram(_programWrapper.program);
|
|
133
|
-
gl.uniformMatrix2fv(_programWrapper.u_bbox_matrix, false, new Float32Array([
|
|
134
|
-
1 / (x1 - x0), 0, -x0 / (x1 - x0), 0,
|
|
135
|
-
0, 1 / (y1 - y0), -y0 / (y1 - y0), 0,
|
|
136
|
-
0, 0, 1, 0,
|
|
137
|
-
0, 0, 0, 1
|
|
138
|
-
]));
|
|
139
|
-
gl.useProgram(currentProgram);
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { createProgram } from "../webglobjectbuilders";
|
|
2
|
-
import { shaderfunctions } from "..";
|
|
3
|
-
import { latLongBboxtoPixelXYBbox } from "..";
|
|
4
|
-
/** TODO:
|
|
5
|
-
* 3d icin calistir
|
|
6
|
-
*/
|
|
7
|
-
//TODO: DELETE THIS FILE.
|
|
8
|
-
|
|
9
|
-
class TextureToGlobeProgram {
|
|
10
|
-
constructor(gl, globe) {
|
|
11
|
-
this.globe = globe;
|
|
12
|
-
this.gl = gl;
|
|
13
|
-
this._is3D = true;
|
|
14
|
-
this._programWrapper = this._createProgramWrapper();
|
|
15
|
-
this._resizeHandler = this._resizeEventHandler.bind(this);
|
|
16
|
-
window.addEventListener('resize',
|
|
17
|
-
this._resizeHandler
|
|
18
|
-
, true);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
_initUniforms() {
|
|
22
|
-
|
|
23
|
-
const { gl, _programWrapper } = this;
|
|
24
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
25
|
-
gl.useProgram(_programWrapper.program);
|
|
26
|
-
// set u_alpha
|
|
27
|
-
gl.uniformMatrix3fv(_programWrapper.u_bbox_matrix, false, new Float32Array([
|
|
28
|
-
1, 0, 0,
|
|
29
|
-
0, 1, 0,
|
|
30
|
-
0, 0, 1]));
|
|
31
|
-
gl.uniform1f(_programWrapper.u_alpha, 1.0);
|
|
32
|
-
gl.uniform1f(_programWrapper.u_is3D, 1.0);
|
|
33
|
-
gl.uniform1f(_programWrapper.height, 0.0);
|
|
34
|
-
gl.useProgram(currentProgram);
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
_createProgramWrapper() {
|
|
39
|
-
const gl = this.gl;
|
|
40
|
-
const vertexSource = `#version 300 es
|
|
41
|
-
precision highp float;
|
|
42
|
-
|
|
43
|
-
in vec2 a_position;
|
|
44
|
-
|
|
45
|
-
uniform mat3 u_bbox_matrix;
|
|
46
|
-
|
|
47
|
-
uniform mat4 u_model_view_matrix;
|
|
48
|
-
uniform mat4 u_proj_matrix;
|
|
49
|
-
uniform vec3 u_transpos;
|
|
50
|
-
|
|
51
|
-
uniform vec2 u_mapWH;
|
|
52
|
-
uniform vec2 u_scrWH;
|
|
53
|
-
|
|
54
|
-
uniform bool u_is3D;
|
|
55
|
-
uniform float height;
|
|
56
|
-
|
|
57
|
-
out vec2 v_texcoord;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
` + shaderfunctions.pixelXYToCartesian3DPoint + `
|
|
61
|
-
` + shaderfunctions.pixelXYToCartesian2DPoint + `
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
void main() {
|
|
65
|
-
vec3 pos = u_bbox_matrix * vec3(a_position, height);
|
|
66
|
-
if(u_is3D){
|
|
67
|
-
pos = pixelXYToCartesian3DPoint(pos);
|
|
68
|
-
gl_Position = u_proj_matrix * u_model_view_matrix * vec4(pos - u_transpos, 1.0);
|
|
69
|
-
} else {
|
|
70
|
-
vec2 xy = pixelXYToCartesian2DPoint(pos.xy, u_transpos.xy, u_mapWH, u_scrWH);
|
|
71
|
-
gl_Position = u_proj_matrix * vec4(xy.x, xy.y, 0.0, 1.0);
|
|
72
|
-
}
|
|
73
|
-
gl_PointSize = 100.0;
|
|
74
|
-
v_texcoord = a_position * 0.5 + 0.5; // need a check
|
|
75
|
-
}
|
|
76
|
-
`;
|
|
77
|
-
|
|
78
|
-
const fragmentSource = `#version 300 es
|
|
79
|
-
precision highp float;
|
|
80
|
-
|
|
81
|
-
in vec2 v_texcoord;
|
|
82
|
-
|
|
83
|
-
uniform float u_alpha;
|
|
84
|
-
uniform sampler2D u_texture;
|
|
85
|
-
|
|
86
|
-
out vec4 outColor;
|
|
87
|
-
|
|
88
|
-
void main() {
|
|
89
|
-
// outColor = texture(u_texture, v_texcoord);
|
|
90
|
-
// outColor.a *= u_alpha;
|
|
91
|
-
outColor = vec4(1.0, 0.0, 0.0, 0.5);
|
|
92
|
-
}
|
|
93
|
-
`;
|
|
94
|
-
|
|
95
|
-
const program = createProgram(gl, vertexSource, fragmentSource);
|
|
96
|
-
const vao = gl.createVertexArray();
|
|
97
|
-
|
|
98
|
-
const buffer = gl.createBuffer();
|
|
99
|
-
gl.bindVertexArray(vao);
|
|
100
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
101
|
-
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
102
|
-
0, 0,
|
|
103
|
-
1, 0,
|
|
104
|
-
1, 1,
|
|
105
|
-
0, 1
|
|
106
|
-
]), gl.STATIC_DRAW);
|
|
107
|
-
const a_position = - gl.getAttribLocation(program, 'a_position');
|
|
108
|
-
gl.enableVertexAttribArray(a_position);
|
|
109
|
-
gl.vertexAttribPointer(a_position, 2, gl.FLOAT, false, 0, 0);
|
|
110
|
-
gl.bindVertexArray(null);
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
program: program,
|
|
114
|
-
vao: vao,
|
|
115
|
-
u_model_view_matrix: gl.getUniformLocation(program, 'u_model_view_matrix'),
|
|
116
|
-
u_proj_matrix: gl.getUniformLocation(program, 'u_proj_matrix'),
|
|
117
|
-
u_transpos: gl.getUniformLocation(program, 'u_transpos'),
|
|
118
|
-
u_mapWH: gl.getUniformLocation(program, 'u_mapWH'),
|
|
119
|
-
u_scrWH: gl.getUniformLocation(program, 'u_scrWH'),
|
|
120
|
-
u_texture: gl.getUniformLocation(program, 'u_texture'),
|
|
121
|
-
u_bbox_matrix: gl.getUniformLocation(program, 'u_bbox_matrix'),
|
|
122
|
-
u_is3D: gl.getUniformLocation(program, 'u_is3D'),
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
draw(modelViewMatrix, projectionMatrix, transPos, texture) {
|
|
127
|
-
// console.log('draw')
|
|
128
|
-
const { gl, _programWrapper, _is3D } = this;
|
|
129
|
-
gl.useProgram(_programWrapper.program);
|
|
130
|
-
gl.bindVertexArray(_programWrapper.vao);
|
|
131
|
-
gl.uniformMatrix4fv(_programWrapper.u_model_view_matrix, false, modelViewMatrix);
|
|
132
|
-
gl.uniformMatrix4fv(_programWrapper.u_proj_matrix, false, projectionMatrix);
|
|
133
|
-
gl.uniform3f(_programWrapper.u_transpos, transPos.x, transPos.y, transPos.z);
|
|
134
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
135
|
-
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
136
|
-
gl.uniform1i(_programWrapper.u_texture, 0);
|
|
137
|
-
if (!_is3D) {
|
|
138
|
-
const mapWH = this.globe.api_GetCurrentWorldWH();
|
|
139
|
-
gl.uniform2f(_programWrapper.u_mapWH, mapWH.width, mapWH.height);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
|
|
143
|
-
gl.drawArrays(gl.POINTS, 0, 4);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
setBBox(minx, maxx, miny, maxy) {
|
|
147
|
-
const { gl, _programWrapper } = this;
|
|
148
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
149
|
-
gl.useProgram(_programWrapper.program);
|
|
150
|
-
gl.uniformMatrix3fv(_programWrapper.u_bbox_matrix, false, new Float32Array([
|
|
151
|
-
maxx - minx, 0, minx,
|
|
152
|
-
0, maxy - miny, miny,
|
|
153
|
-
0, 0, 1
|
|
154
|
-
]));
|
|
155
|
-
gl.useProgram(currentProgram);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
setLatLongBBox(minx, maxx, miny, maxy) {
|
|
159
|
-
const bboxMatrix = latLongBboxtoPixelXYBbox(minx, miny, maxx, maxy);
|
|
160
|
-
const { gl, _programWrapper } = this;
|
|
161
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
162
|
-
gl.useProgram(_programWrapper.program);
|
|
163
|
-
gl.uniformMatrix3fv(_programWrapper.u_bbox_matrix, false, bboxMatrix);
|
|
164
|
-
gl.useProgram(currentProgram);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
setScreenWH() {
|
|
169
|
-
const { gl, _programWrapper, globe } = this;
|
|
170
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
171
|
-
gl.useProgram(_programWrapper.program);
|
|
172
|
-
gl.uniform2f(_programWrapper.u_scrWH, globe.api_ScrW(), globe.api_ScrH());
|
|
173
|
-
gl.useProgram(currentProgram);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
resize() {
|
|
178
|
-
const { globe } = this;
|
|
179
|
-
this.setScreenWH();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
setGeometry() {
|
|
183
|
-
const { gl, globe, _programWrapper } = this;
|
|
184
|
-
this._is3D = globe.api_GetCurrentGeometry() === 0;
|
|
185
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
186
|
-
gl.useProgram(_programWrapper.program);
|
|
187
|
-
gl.uniform1f(_programWrapper.u_is3D, this._is3D ? 1.0 : 0.0);
|
|
188
|
-
gl.useProgram(currentProgram);
|
|
189
|
-
this.resize();
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
free() {
|
|
193
|
-
window.removeEventListener('resize',
|
|
194
|
-
this._resizeHandler, true);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
_resizeEventHandler() {
|
|
198
|
-
this.resize();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export { TextureToGlobeProgram };
|