@pirireis/webglobeplugins 0.6.16 → 0.6.17

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.
@@ -144,8 +144,8 @@ export class CircleLineChainPlugin {
144
144
  ...['centerCoords2d', 'centerCoords3d', 'targetCoords2d', 'targetCoords3d', 'dashRatio', 'dashOpacity', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
145
145
  this.circleVao = this.circleProgram.createVAO(
146
146
  ...["centerCoords2d", "centerCoords3d", "bigRadius", "rgbaCircle", "circleDashAngle", "dashOpacity"].map(key => obj(this.bufferManagersCompMap.get(key))));
147
- // this.toOriginVao = this.lineToTheOriginProgram.createVAO(
148
- // ...["targetCoords", "rgba"].map(key => obj(this.bufferManagersCompMap.get(key))));
147
+ this.toOriginVao = this.lineToTheOriginProgram.createVAO(
148
+ ...["targetCoords3d", "rgba"].map(key => obj(this.bufferManagersCompMap.get(key))));
149
149
  }
150
150
 
151
151
  }
@@ -392,8 +392,8 @@ export class CircleLineChainPlugin {
392
392
  this.lineProgram.draw(this.lineVao, this.bufferOrchestrator.length, this._opacity);
393
393
  if (this._drawCircleOn) this.circleProgram.draw(this.circleVao, this.bufferOrchestrator.length, this._opacity);
394
394
  this._textContextWriterInjectionMap.forEach((writer) => writer.draw());
395
- gl.enable(gl.DEPTH_TEST);
396
395
  this.lineToTheOriginProgram.draw(this.toOriginVao, this.bufferOrchestrator.length, this._opacity);
396
+ gl.enable(gl.DEPTH_TEST);
397
397
  }
398
398
  }
399
399
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.6.16",
3
+ "version": "0.6.17",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -58,7 +58,12 @@ void main() {
58
58
  v_limp = vec2(0.0, 0.0);
59
59
  } else {
60
60
  vec2 position;
61
- position = circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate( center_position, radius, angle);
61
+ if ( radius < 1000.0) {
62
+ float cosine1 = cos(asin(tanh(center_position.y / 6378137.0)));
63
+ position = circleLimpFromLongLatRadCenterMercatorCompass_accurate(center_position, radius / cosine1 , angle);
64
+ } else {
65
+ position = circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate( center_position, radius, angle);
66
+ }
62
67
  v_limp = position;
63
68
  gl_Position = mercatorXYToGLPosition( position);
64
69
 
@@ -19,7 +19,7 @@ ${cartesian3DToGLPosition}
19
19
  in vec2 start_position;
20
20
  in vec3 start_poisition3d;
21
21
  in vec2 end_position;
22
- in vec3 end_position3;
22
+ in vec3 end_position3d;
23
23
  in float dash_ratio;
24
24
  in vec4 color;
25
25
  in float dash_opacity;
@@ -34,7 +34,7 @@ void main() {
34
34
  vec2 longLat;
35
35
  if (is3D) {
36
36
  interpolation = float(gl_VertexID) / ${GLOBE_MIDPOINT_COUNT - 1}.0;
37
- vec3 cartesian = pointsOnSphereBetween(start_poisition3d, end_position3, interpolation) * R_3D;
37
+ vec3 cartesian = pointsOnSphereBetween(start_poisition3d, end_position3d, interpolation) * length(end_position3d);
38
38
  gl_Position = cartesian3DToGLPosition(cartesian);
39
39
  v_limp = vec2(0.0, 0.0);
40
40
  } else {
@@ -18,7 +18,7 @@ ${R_3D}
18
18
  ${longLatRadToCartesian3DWithR}
19
19
  ${cartesian3DToGLPosition}
20
20
 
21
- in vec2 position2d;
21
+ in vec3 position3d;
22
22
  in vec4 rgba;
23
23
  uniform float origin_r;
24
24
  flat out vec4 v_rgba;
@@ -28,10 +28,10 @@ void main() {
28
28
  if (!is3D) {return;}
29
29
  vec3 cartesian;
30
30
  if(gl_VertexID == 0) {
31
- cartesian = longLatRadToCartesian3DWithR(position2d, R_3D);
31
+ cartesian = normalize( position3d) * R_3D;
32
32
  interpolation_value = 1.0;
33
33
  } else {
34
- cartesian = longLatRadToCartesian3DWithR(position2d, origin_r);
34
+ cartesian = position3d;
35
35
  interpolation_value = 0.0;
36
36
  }
37
37
  gl_Position = cartesian3DToGLPosition(cartesian);
@@ -48,11 +48,12 @@ in float interpolation_value;
48
48
  flat in vec4 v_rgba;
49
49
  out vec4 color;
50
50
  void main(){
51
- if ( fract( interpolation_value * 100.0) < 0.5) {discard;}
51
+ if ( fract( interpolation_value * 30.0) < 0.5) {discard;}
52
52
  color = vec4(
53
- v_rgba.rgb,
54
- v_rgba.a * plugin_opacity * interpolation_value * 0.9
53
+ v_rgba.rgb * 1.2,
54
+ v_rgba.a * plugin_opacity
55
55
  );
56
+
56
57
  }`;
57
58
 
58
59
 
@@ -65,7 +66,7 @@ class Logic {
65
66
  this._lastOriginR = 6378.137 - 1;
66
67
  const { gl, program } = this;
67
68
  {
68
- gl.bindAttribLocation(program, 0, "position2d");
69
+ gl.bindAttribLocation(program, 0, "position3d");
69
70
  gl.bindAttribLocation(program, 1, "rgba");
70
71
 
71
72
  }
@@ -105,12 +106,10 @@ class Logic {
105
106
  gl.uniform1f(this._originRLocation, originR);
106
107
  this._lastOriginR = originR;
107
108
  }
108
-
109
- // gl.disable(gl.DEPTH_TEST);
110
109
  gl.drawArraysInstanced(gl.LINE_STRIP, 0, 2, length);
110
+ gl.drawArraysInstanced(gl.POINTS, 0, 2, length);
111
111
  gl.bindVertexArray(null);
112
112
  cameraBlockTotem.unbind(cameraBlockBindingPoint);
113
- // gl.enable(gl.DEPTH_TEST);
114
113
  }
115
114
 
116
115
  _checkOpacity(opacity) {
@@ -122,15 +121,15 @@ class Logic {
122
121
  if (r < 0.0 || r > 6378.137 - 0.3) throw RangeError("r should be between 0 and 6378.137 - 0.3");
123
122
  }
124
123
 
125
- createVAO(potisionBufferObj, colorBufferObj) {
124
+ createVAO(potision3dBufferObj, colorBufferObj) {
126
125
  const { gl } = this;
127
126
  const vao = gl.createVertexArray();
128
127
  gl.bindVertexArray(vao);
129
128
  {
130
- const { buffer, stride = 0, offset = 0 } = potisionBufferObj;
129
+ const { buffer, stride = 0, offset = 0 } = potision3dBufferObj;
131
130
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
132
131
  gl.enableVertexAttribArray(0);
133
- gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
132
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, false, stride, offset);
134
133
  gl.vertexAttribDivisor(0, 1);
135
134
  }
136
135
  {