@pirireis/webglobeplugins 0.12.0-alpha → 0.13.0-alpha

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.
@@ -1,5 +1,6 @@
1
- import { programCache as circleProgramCache } from './circleflatprogram';
2
- import { PaddingProgramCache } from './paddyflatprogram';
3
- import CirclePaddySharedBuffer from './circlepaddysharedbuffer';
4
- import { PaddingFreeAngleCache } from './circlepaddingfreeangleprogram';
5
- export { circleProgramCache, PaddingProgramCache, CirclePaddySharedBuffer, PaddingFreeAngleCache };
1
+ "use strict";
2
+ // import { programCache as circleProgramCache } from './circleflatprogram';
3
+ // import { PaddingProgramCache } from './paddyflatprogram';
4
+ // import CirclePaddySharedBuffer from './circlepaddysharedbuffer';
5
+ // // import { PaddingFreeAngleCache } from './circlepaddingfreeangleprogram';
6
+ // // export { circleProgramCache, PaddingProgramCache, CirclePaddySharedBuffer, PaddingFreeAngleCache };
@@ -1,136 +1,127 @@
1
- import { createProgram, shaderfunctions } from "../../../util";
2
- import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
3
- import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
4
- const vertexShader = `#version 300 es ` +
5
- shaderfunctions.PI +
6
- shaderfunctions.R +
7
- shaderfunctions.POLE +
8
- CameraUniformBlockString +
9
- shaderfunctions.mercatorXYToGLPosition +
10
- shaderfunctions.longLatRadToMercator +
11
- shaderfunctions.longLatRadToCartesian3D +
12
- shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
13
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
14
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
15
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
16
-
17
- in vec2 center;
18
- in float radius;
19
- in float pad_range;
20
- in vec4 color;
21
- in float flag;
22
-
23
- uniform int compass;
24
- uniform float pad_count;
25
-
26
- uniform float opacity;
27
-
28
-
29
- out vec2 v_limp;
30
- out vec4 v_color;
31
-
32
-
33
- void main() {
34
-
35
- float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
36
- if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
37
- v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
38
-
39
- gl_PointSize = 2.0;
40
-
41
- float odd = mod(float(gl_VertexID), 2.0);
42
- float index = (float(gl_VertexID)- odd ) / 2.0;
43
- float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
44
- float radius_ = radius - (pad_range * odd);
45
-
46
- if ( is3D){
47
- gl_Position = projection * view * vec4(
48
- circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
49
- v_limp = vec2(0.0, 0.0);
50
- return;
51
- }
52
- vec2 limp;
53
- if ( compass == 1 ){
54
- limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
55
- } else {
56
- // limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
57
- limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
58
- }
59
- v_limp = limp;
60
- gl_Position = mercatorXYToGLPosition(limp);
61
- }`;
62
- const fragmentShader = `#version 300 es
63
- precision highp float; ` +
64
- shaderfunctions.POLE + `
65
- in vec4 v_color;
66
- in vec2 v_limp;
67
- out vec4 outColor;
68
- void main() {
69
- if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
70
- outColor = v_color;
71
- }`;
72
- class Logic {
73
- constructor(globe) {
74
- this.globe = globe;
75
- this.gl = globe.gl;
76
- this.program = createProgram(this.gl, vertexShader, fragmentShader);
77
- { // bind positions so bufferManager can use them
78
- this.gl.bindAttribLocation(this.program, 0, "center");
79
- this.gl.bindAttribLocation(this.program, 1, "radius");
80
- this.gl.bindAttribLocation(this.program, 2, "pad_range");
81
- this.gl.bindAttribLocation(this.program, 3, "color");
82
- this.gl.bindAttribLocation(this.program, 4, "flag");
83
- }
84
- this.cameraBlockBindingPoint = 0;
85
- const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
86
- this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
87
- this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
88
- this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
89
- this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
90
- this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
91
- this._compassMode = 1;
92
- this._opacity = 1.0;
93
- this._padCount = 360;
94
- {
95
- const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
96
- this.gl.useProgram(this.program);
97
- this.gl.uniform1i(this._compassLocation, 1);
98
- this.gl.uniform1f(this._opacityLocation, 1.0);
99
- this.gl.uniform1f(this._padCountLocation, 360);
100
- this.gl.useProgram(currentProgram);
101
- }
102
- }
103
- draw(attrBufferManager, padCount, compass, opacity) {
104
- const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
105
- gl.useProgram(program);
106
- attrBufferManager.bindPaddingVAO();
107
- cameraBlockTotem.bind(cameraBlockBindingPoint);
108
- // draw instanced
109
- if (padCount !== this._padCount) {
110
- this._padCount = padCount;
111
- // console.log("padCount", padCount);
112
- gl.uniform1f(_padCountLocation, padCount);
113
- }
114
- if (compass !== this._compassMode) {
115
- // console.log("compass", compass);
116
- gl.uniform1i(_compassLocation, compass);
117
- this._compassMode = compass;
118
- }
119
- if (opacity !== this._opacity) {
120
- // console.log("opacity", opacity);
121
- this._opacity = opacity;
122
- gl.uniform1f(this._opacityLocation, opacity);
123
- }
124
- gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
125
- gl.bindVertexArray(null);
126
- cameraBlockTotem.unbind(cameraBlockBindingPoint);
127
- }
128
- free() {
129
- this.gl.deleteProgram(this.program);
130
- globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
131
- }
132
- }
133
- export const PaddingProgramCache = Object.freeze({
134
- getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic); },
135
- releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
136
- });
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 { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
6
+ // const vertexShader = `#version 300 es ` +
7
+ // shaderfunctions.PI +
8
+ // shaderfunctions.R +
9
+ // shaderfunctions.POLE +
10
+ // CameraUniformBlockString +
11
+ // shaderfunctions.mercatorXYToGLPosition +
12
+ // shaderfunctions.longLatRadToMercator +
13
+ // shaderfunctions.longLatRadToCartesian3D +
14
+ // shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
15
+ // shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
16
+ // shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
17
+ // shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
18
+ // in vec2 center;
19
+ // in float radius;
20
+ // in float pad_range;
21
+ // in vec4 color;
22
+ // in float flag;
23
+ // uniform int compass;
24
+ // uniform float pad_count;
25
+ // uniform float opacity;
26
+ // out vec2 v_limp;
27
+ // out vec4 v_color;
28
+ // void main() {
29
+ // float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
30
+ // if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
31
+ // v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
32
+ // gl_PointSize = 2.0;
33
+ // float odd = mod(float(gl_VertexID), 2.0);
34
+ // float index = (float(gl_VertexID)- odd ) / 2.0;
35
+ // float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
36
+ // float radius_ = radius - (pad_range * odd);
37
+ // if ( is3D){
38
+ // gl_Position = projection * view * vec4(
39
+ // circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
40
+ // v_limp = vec2(0.0, 0.0);
41
+ // return;
42
+ // }
43
+ // vec2 limp;
44
+ // if ( compass == 1 ){
45
+ // limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
46
+ // } else {
47
+ // // limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
48
+ // limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
49
+ // }
50
+ // v_limp = limp;
51
+ // gl_Position = mercatorXYToGLPosition(limp);
52
+ // }`;
53
+ // const fragmentShader = `#version 300 es
54
+ // precision highp float; `+
55
+ // shaderfunctions.POLE + `
56
+ // in vec4 v_color;
57
+ // in vec2 v_limp;
58
+ // out vec4 outColor;
59
+ // void main() {
60
+ // if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
61
+ // outColor = v_color;
62
+ // }`;
63
+ // class Logic {
64
+ // constructor(globe) {
65
+ // this.globe = globe;
66
+ // this.gl = globe.gl;
67
+ // this.program = createProgram(this.gl, vertexShader, fragmentShader);
68
+ // { // bind positions so bufferManager can use them
69
+ // this.gl.bindAttribLocation(this.program, 0, "center");
70
+ // this.gl.bindAttribLocation(this.program, 1, "radius");
71
+ // this.gl.bindAttribLocation(this.program, 2, "pad_range");
72
+ // this.gl.bindAttribLocation(this.program, 3, "color");
73
+ // this.gl.bindAttribLocation(this.program, 4, "flag");
74
+ // }
75
+ // this.cameraBlockBindingPoint = 0;
76
+ // const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
77
+ // this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
78
+ // this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
79
+ // this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
80
+ // this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
81
+ // this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
82
+ // this._compassMode = 1;
83
+ // this._opacity = 1.0;
84
+ // this._padCount = 360;
85
+ // {
86
+ // const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
87
+ // this.gl.useProgram(this.program);
88
+ // this.gl.uniform1i(this._compassLocation, 1);
89
+ // this.gl.uniform1f(this._opacityLocation, 1.0);
90
+ // this.gl.uniform1f(this._padCountLocation, 360)
91
+ // this.gl.useProgram(currentProgram);
92
+ // }
93
+ // }
94
+ // draw(attrBufferManager, padCount, compass, opacity) {
95
+ // const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
96
+ // gl.useProgram(program);
97
+ // attrBufferManager.bindPaddingVAO();
98
+ // cameraBlockTotem.bind(cameraBlockBindingPoint);
99
+ // // draw instanced
100
+ // if (padCount !== this._padCount) {
101
+ // this._padCount = padCount;
102
+ // // console.log("padCount", padCount);
103
+ // gl.uniform1f(_padCountLocation, padCount);
104
+ // }
105
+ // if (compass !== this._compassMode) {
106
+ // // console.log("compass", compass);
107
+ // gl.uniform1i(_compassLocation, compass);
108
+ // this._compassMode = compass;
109
+ // }
110
+ // if (opacity !== this._opacity) {
111
+ // // console.log("opacity", opacity);
112
+ // this._opacity = opacity;
113
+ // gl.uniform1f(this._opacityLocation, opacity);
114
+ // }
115
+ // gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
116
+ // gl.bindVertexArray(null);
117
+ // cameraBlockTotem.unbind(cameraBlockBindingPoint);
118
+ // }
119
+ // free() {
120
+ // this.gl.deleteProgram(this.program);
121
+ // globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
122
+ // }
123
+ // }
124
+ // export const PaddingProgramCache = Object.freeze({
125
+ // getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
126
+ // releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
127
+ // })
@@ -1,138 +1,129 @@
1
- import { createProgram, shaderfunctions } from "../../../util";
2
- import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
3
- import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
4
- const vertexShader = `#version 300 es ` +
5
- shaderfunctions.PI +
6
- shaderfunctions.R +
7
- shaderfunctions.POLE +
8
- CameraUniformBlockString +
9
- shaderfunctions.mercatorXYToGLPosition +
10
- shaderfunctions.longLatRadToMercator +
11
- shaderfunctions.longLatRadToCartesian3D +
12
- shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
13
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
14
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
15
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
16
-
17
- in vec2 center;
18
- in float radius;
19
- in float pad_range;
20
- in vec4 color;
21
- in float flag;
22
-
23
- uniform int compass;
24
- uniform float pad_count;
25
-
26
- uniform float opacity;
27
-
28
-
29
- out vec2 v_limp;
30
- out vec4 v_color;
31
-
32
-
33
- void main() {
34
-
35
- float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
36
- if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
37
- v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
38
-
39
- gl_PointSize = 2.0;
40
-
41
- float odd = mod(float(gl_VertexID), 2.0);
42
- float index = (float(gl_VertexID)- odd ) / 2.0;
43
- float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
44
- float radius_ = radius - (pad_range * odd);
45
-
46
- if ( is3D){
47
- gl_Position = projection * view * vec4(
48
- circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
49
- v_limp = vec2(0.0, 0.0);
50
- return;
51
- }
52
- vec2 limp;
53
- if ( compass == 1 ){
54
- limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
55
- } else {
56
- // limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
57
- limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
58
- }
59
- v_limp = limp;
60
- gl_Position = mercatorXYToGLPosition(limp);
61
- }`;
62
- const fragmentShader = `#version 300 es
63
- precision highp float; ` +
64
- shaderfunctions.POLE + `
65
- in vec4 v_color;
66
- in vec2 v_limp;
67
- out vec4 outColor;
68
- void main() {
69
- if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
70
- outColor = v_color;
71
- }`;
72
- class Logic {
73
- constructor(globe) {
74
- this.globe = globe;
75
- this.gl = globe.gl;
76
- this.program = createProgram(this.gl, vertexShader, fragmentShader);
77
- { // bind positions so bufferManager can use them
78
- this.gl.bindAttribLocation(this.program, 0, "center");
79
- this.gl.bindAttribLocation(this.program, 1, "radius");
80
- this.gl.bindAttribLocation(this.program, 2, "pad_range");
81
- this.gl.bindAttribLocation(this.program, 3, "color");
82
- this.gl.bindAttribLocation(this.program, 4, "flag");
83
- }
84
- this.cameraBlockBindingPoint = 0;
85
- const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
86
- this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
87
- this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
88
- this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
89
- this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
90
- this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
91
- this._compassMode = 1;
92
- this._opacity = 1.0;
93
- this._padCount = 360;
94
- {
95
- const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
96
- this.gl.useProgram(this.program);
97
- this.gl.uniform1i(this._compassLocation, 1);
98
- this.gl.uniform1f(this._opacityLocation, 1.0);
99
- this.gl.uniform1f(this._padCountLocation, 360);
100
- this.gl.useProgram(currentProgram);
101
- }
102
- }
103
- draw(vao, length, opaity) {
104
- }
105
- draw(attrBufferManager, padCount, compass, opacity) {
106
- const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
107
- gl.useProgram(program);
108
- attrBufferManager.bindPaddingVAO();
109
- cameraBlockTotem.bind(cameraBlockBindingPoint);
110
- // draw instanced
111
- if (padCount !== this._padCount) {
112
- this._padCount = padCount;
113
- // console.log("padCount", padCount);
114
- gl.uniform1f(_padCountLocation, padCount);
115
- }
116
- if (compass !== this._compassMode) {
117
- // console.log("compass", compass);
118
- gl.uniform1i(_compassLocation, compass);
119
- this._compassMode = compass;
120
- }
121
- if (opacity !== this._opacity) {
122
- // console.log("opacity", opacity);
123
- this._opacity = opacity;
124
- gl.uniform1f(this._opacityLocation, opacity);
125
- }
126
- gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
127
- gl.bindVertexArray(null);
128
- cameraBlockTotem.unbind(cameraBlockBindingPoint);
129
- }
130
- free() {
131
- this.gl.deleteProgram(this.program);
132
- globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
133
- }
134
- }
135
- export const PaddingProgramCache = Object.freeze({
136
- getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic); },
137
- releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
138
- });
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 { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
6
+ // const vertexShader = `#version 300 es ` +
7
+ // shaderfunctions.PI +
8
+ // shaderfunctions.R +
9
+ // shaderfunctions.POLE +
10
+ // CameraUniformBlockString +
11
+ // shaderfunctions.mercatorXYToGLPosition +
12
+ // shaderfunctions.longLatRadToMercator +
13
+ // shaderfunctions.longLatRadToCartesian3D +
14
+ // shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
15
+ // shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
16
+ // shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
17
+ // shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
18
+ // in vec2 center;
19
+ // in float radius;
20
+ // in float pad_range;
21
+ // in vec4 color;
22
+ // in float flag;
23
+ // uniform int compass;
24
+ // uniform float pad_count;
25
+ // uniform float opacity;
26
+ // out vec2 v_limp;
27
+ // out vec4 v_color;
28
+ // void main() {
29
+ // float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
30
+ // if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
31
+ // v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
32
+ // gl_PointSize = 2.0;
33
+ // float odd = mod(float(gl_VertexID), 2.0);
34
+ // float index = (float(gl_VertexID)- odd ) / 2.0;
35
+ // float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
36
+ // float radius_ = radius - (pad_range * odd);
37
+ // if ( is3D){
38
+ // gl_Position = projection * view * vec4(
39
+ // circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
40
+ // v_limp = vec2(0.0, 0.0);
41
+ // return;
42
+ // }
43
+ // vec2 limp;
44
+ // if ( compass == 1 ){
45
+ // limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
46
+ // } else {
47
+ // // limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
48
+ // limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
49
+ // }
50
+ // v_limp = limp;
51
+ // gl_Position = mercatorXYToGLPosition(limp);
52
+ // }`;
53
+ // const fragmentShader = `#version 300 es
54
+ // precision highp float; `+
55
+ // shaderfunctions.POLE + `
56
+ // in vec4 v_color;
57
+ // in vec2 v_limp;
58
+ // out vec4 outColor;
59
+ // void main() {
60
+ // if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
61
+ // outColor = v_color;
62
+ // }`;
63
+ // class Logic {
64
+ // constructor(globe) {
65
+ // this.globe = globe;
66
+ // this.gl = globe.gl;
67
+ // this.program = createProgram(this.gl, vertexShader, fragmentShader);
68
+ // { // bind positions so bufferManager can use them
69
+ // this.gl.bindAttribLocation(this.program, 0, "center");
70
+ // this.gl.bindAttribLocation(this.program, 1, "radius");
71
+ // this.gl.bindAttribLocation(this.program, 2, "pad_range");
72
+ // this.gl.bindAttribLocation(this.program, 3, "color");
73
+ // this.gl.bindAttribLocation(this.program, 4, "flag");
74
+ // }
75
+ // this.cameraBlockBindingPoint = 0;
76
+ // const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
77
+ // this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
78
+ // this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
79
+ // this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
80
+ // this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
81
+ // this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
82
+ // this._compassMode = 1;
83
+ // this._opacity = 1.0;
84
+ // this._padCount = 360;
85
+ // {
86
+ // const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
87
+ // this.gl.useProgram(this.program);
88
+ // this.gl.uniform1i(this._compassLocation, 1);
89
+ // this.gl.uniform1f(this._opacityLocation, 1.0);
90
+ // this.gl.uniform1f(this._padCountLocation, 360)
91
+ // this.gl.useProgram(currentProgram);
92
+ // }
93
+ // }
94
+ // draw(vao, length, opaity) {
95
+ // }
96
+ // draw(attrBufferManager, padCount, compass, opacity) {
97
+ // const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
98
+ // gl.useProgram(program);
99
+ // attrBufferManager.bindPaddingVAO();
100
+ // cameraBlockTotem.bind(cameraBlockBindingPoint);
101
+ // // draw instanced
102
+ // if (padCount !== this._padCount) {
103
+ // this._padCount = padCount;
104
+ // // console.log("padCount", padCount);
105
+ // gl.uniform1f(_padCountLocation, padCount);
106
+ // }
107
+ // if (compass !== this._compassMode) {
108
+ // // console.log("compass", compass);
109
+ // gl.uniform1i(_compassLocation, compass);
110
+ // this._compassMode = compass;
111
+ // }
112
+ // if (opacity !== this._opacity) {
113
+ // // console.log("opacity", opacity);
114
+ // this._opacity = opacity;
115
+ // gl.uniform1f(this._opacityLocation, opacity);
116
+ // }
117
+ // gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
118
+ // gl.bindVertexArray(null);
119
+ // cameraBlockTotem.unbind(cameraBlockBindingPoint);
120
+ // }
121
+ // free() {
122
+ // this.gl.deleteProgram(this.program);
123
+ // globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
124
+ // }
125
+ // }
126
+ // export const PaddingProgramCache = Object.freeze({
127
+ // getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic) },
128
+ // releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic) }
129
+ // })