@pirireis/webglobeplugins 0.12.0-alpha → 0.14.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.
Files changed (68) hide show
  1. package/Math/arc-cdf-points.js +20 -0
  2. package/Math/arc-generate-points copy.js +1 -0
  3. package/Math/arc.js +21 -8
  4. package/Math/circle-cdf-points.js +0 -2
  5. package/Math/circle.js +35 -16
  6. package/Math/templete-shapes/grid-visually-equal.js +66 -0
  7. package/altitude-locator/plugin.js +3 -2
  8. package/bearing-line/plugin.js +1 -2
  9. package/circle-line-chain/plugin.js +4 -7
  10. package/compass-rose/compass-rose-padding-flat.js +12 -0
  11. package/package.json +1 -1
  12. package/programs/line-on-globe/degree-padding-around-circle-3d.js +1 -1
  13. package/programs/line-on-globe/linestrip/data.js +4 -0
  14. package/programs/line-on-globe/{linestrip.js → linestrip/linestrip.js} +37 -35
  15. package/programs/line-on-globe/naive-accurate-flexible.js +23 -16
  16. package/programs/picking/pickable-renderer.js +1 -2
  17. package/programs/rings/distancering/circleflatprogram.js +116 -120
  18. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +1 -1
  19. package/programs/rings/distancering/circlepaddysharedbuffer.js +368 -354
  20. package/programs/rings/distancering/index.js +6 -5
  21. package/programs/rings/distancering/paddyflatprogram.js +127 -136
  22. package/programs/rings/distancering/paddyflatprogram2d.js +129 -138
  23. package/programs/rings/distancering/paddyflatprogram3d.js +128 -136
  24. package/programs/rings/partial-ring/piece-of-pie copy.js +286 -0
  25. package/programs/rings/partial-ring/piece-of-pie.js +26 -13
  26. package/programs/totems/camerauniformblock.js +1 -1
  27. package/programs/totems/index.js +1 -1
  28. package/programs/vectorfields/logics/pixelbased.js +5 -21
  29. package/range-tools-on-terrain/bearing-line/adapters.js +111 -0
  30. package/range-tools-on-terrain/bearing-line/plugin.js +360 -0
  31. package/range-tools-on-terrain/bearing-line/types.js +1 -0
  32. package/range-tools-on-terrain/circle-line-chain/adapters.js +83 -0
  33. package/range-tools-on-terrain/circle-line-chain/chain-list-map.js +351 -0
  34. package/range-tools-on-terrain/circle-line-chain/plugin.js +389 -0
  35. package/range-tools-on-terrain/circle-line-chain/types.js +1 -0
  36. package/range-tools-on-terrain/range-ring/adapters.js +25 -0
  37. package/range-tools-on-terrain/range-ring/plugin.js +31 -0
  38. package/range-tools-on-terrain/range-ring/types.js +1 -0
  39. package/rangerings/plugin.js +7 -11
  40. package/semiplugins/lightweight/line-plugin.js +195 -0
  41. package/semiplugins/lightweight/piece-of-pie-plugin.js +175 -0
  42. package/semiplugins/shape-on-terrain/arc-plugin.js +368 -0
  43. package/{shape-on-terrain/circle/plugin.js → semiplugins/shape-on-terrain/circle-plugin.js} +129 -68
  44. package/semiplugins/shape-on-terrain/derived/padding-plugin.js +96 -0
  45. package/semiplugins/type.js +1 -0
  46. package/types.js +0 -11
  47. package/util/account/create-buffermap-orchastration.js +39 -0
  48. package/util/account/index.js +2 -2
  49. package/util/account/single-attribute-buffer-management/buffer-manager.js +2 -3
  50. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +14 -3
  51. package/util/build-strategy/static-dynamic.js +1 -1
  52. package/util/check/typecheck.js +15 -1
  53. package/util/geometry/index.js +3 -2
  54. package/util/gl-util/buffer/attribute-loader.js +2 -5
  55. package/util/gl-util/draw-options/methods.js +4 -5
  56. package/util/webglobjectbuilders.js +4 -9
  57. package/write-text/context-text3.js +17 -0
  58. package/write-text/context-text3old.js +152 -0
  59. package/programs/line-on-globe/circle-accurate.js +0 -175
  60. package/programs/line-on-globe/circle.js +0 -164
  61. package/programs/line-on-globe/to-the-surface.js +0 -109
  62. package/programs/rings/distancering/shader.js +0 -1
  63. package/programs/totems/canvas-webglobe-info1.js +0 -106
  64. package/shape-on-terrain/arc/naive/plugin.js +0 -205
  65. package/util/check/get.js +0 -14
  66. package/util/gl-util/buffer/types.js +0 -1
  67. package/util/gl-util/draw-options/types.js +0 -15
  68. package/util/webglobjectbuilders1.js +0 -219
@@ -1,120 +1,116 @@
1
- import { createProgram, shaderfunctions } from "../../../util";
2
- import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
3
- import { noRegisterGlobeProgramCache, globeProgramCache } from "../../programcache";
4
- const CIRCLE_EDGE_COUNT = 360;
5
- const vertexShader = `#version 300 es ` +
6
- shaderfunctions.PI +
7
- shaderfunctions.R +
8
- shaderfunctions.POLE +
9
- CameraUniformBlockString +
10
- shaderfunctions.mercatorXYToGLPosition +
11
- shaderfunctions.longLatRadToMercator +
12
- shaderfunctions.longLatRadToCartesian3D +
13
- shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
14
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
15
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
16
-
17
- uniform int compass;
18
- uniform float circle_edge_count;
19
-
20
- uniform float opacity;
21
-
22
- in vec2 center;
23
- in float radius;
24
- in vec4 color;
25
- in float flag;
26
- out vec4 v_color;
27
- out vec2 v_limp;
28
-
29
- void main() {
30
- if( flag == 1.0 || radius == 0.0) return; // flag 1.0 is hide
31
- v_color = vec4(color.rgb, color.a * opacity);
32
- if ( gl_VertexID == 270 ) v_color.rgb += 0.2;
33
- float angle = 3.1415926535897932384626433832795 * 2.0 * (float(gl_VertexID) / circle_edge_count);
34
- if ( is3D ){
35
- gl_Position = projection * view * vec4(
36
- circleLimpFromLongLatRadCenterCartesian3D( center, radius, angle) - translate, 1.0);
37
- v_limp = vec2(0.0, 0.0);
38
- return;
39
- }
40
- vec2 limp;
41
- if ( compass == 1 ){
42
- limp = circleLimpFromLongLatRadCenterMercatorCompass(center, radius, angle);
43
- } else {
44
- limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius, angle);
45
- }
46
- v_limp = limp;
47
- gl_Position = mercatorXYToGLPosition(limp);
48
-
49
- }`;
50
- const fragmentShader = `#version 300 es
51
- precision highp float;` +
52
- shaderfunctions.POLE + `
53
-
54
- in vec4 v_color;
55
- in vec2 v_limp;
56
- out vec4 outColor;
57
- void main() {
58
- if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
59
- outColor = v_color;
60
- }`;
61
- class Logic {
62
- constructor(globe) {
63
- this.globe = globe;
64
- this.gl = globe.gl;
65
- this.program = createProgram(this.gl, vertexShader, fragmentShader);
66
- { // bind positions so bufferManager can use them
67
- this.gl.bindAttribLocation(this.program, 0, "center");
68
- this.gl.bindAttribLocation(this.program, 1, "radius");
69
- this.gl.bindAttribLocation(this.program, 2, "color");
70
- this.gl.bindAttribLocation(this.program, 3, "flag");
71
- }
72
- this.cameraBlockBindingPoint = 0;
73
- this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
74
- const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
75
- this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
76
- this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
77
- this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
78
- this._circleEdgeCountLocation = this.gl.getUniformLocation(this.program, "circle_edge_count");
79
- this._circleEdgeCount = CIRCLE_EDGE_COUNT;
80
- this._compassmode = 1;
81
- this._opacity = 1.0;
82
- {
83
- const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
84
- this.gl.useProgram(this.program);
85
- this.gl.uniform1i(this._compassLocation, 1);
86
- this.gl.uniform1f(this._circleEdgeCountLocation, CIRCLE_EDGE_COUNT);
87
- this.gl.uniform1f(this._opacityLocation, 1.0);
88
- this.gl.useProgram(currentProgram);
89
- }
90
- }
91
- draw(attrBufferManager, compass, circleEdgeCount, opacity) {
92
- const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
93
- gl.useProgram(program);
94
- cameraBlockTotem.bind(cameraBlockBindingPoint);
95
- attrBufferManager.bindCircleVAO();
96
- if (compass !== this._compassmode) {
97
- gl.uniform1i(this._compassLocation, compass);
98
- this._compassmode = compass;
99
- }
100
- if (opacity !== this._opacity) {
101
- gl.uniform1f(this._opacityLocation, opacity);
102
- this._opacity = opacity;
103
- }
104
- if (circleEdgeCount !== this._circleEdgeCount) {
105
- gl.uniform1f(this._circleEdgeCountLocation, circleEdgeCount);
106
- this._circleEdgeCount = circleEdgeCount;
107
- }
108
- gl.drawArraysInstanced(gl.LINE_LOOP, 0, circleEdgeCount, attrBufferManager.length);
109
- gl.bindVertexArray(null);
110
- cameraBlockTotem.unbind(cameraBlockBindingPoint);
111
- }
112
- free() {
113
- this.gl.deleteProgram(this.program);
114
- globeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
115
- }
116
- }
117
- export const programCache = Object.freeze({
118
- getProgram: (globe) => { return noRegisterGlobeProgramCache.getProgram(globe, Logic); },
119
- releaseProgram: (globe) => { noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
120
- });
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
+ // });
@@ -120,7 +120,7 @@ class Logic {
120
120
  return new BufferManager(this.gl, bufferType, initialRingCapacity);
121
121
  }
122
122
  }
123
- export const PaddingFreeAngleCache = Object.freeze({
123
+ const PaddingFreeAngleCache = Object.freeze({
124
124
  getProgram: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
125
125
  releaseProgram: (globe) => globeProgramCache.releaseProgram(globe, Logic)
126
126
  });