@openglobus/og 0.16.0 → 0.16.2

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.
@@ -27,13 +27,14 @@ export function rayScreen() {
27
27
  },
28
28
  vertexShader:
29
29
  `precision highp float;
30
- attribute vec2 a_vertices;
30
+
31
+ attribute vec4 a_rgba;
31
32
  attribute vec3 a_startPosHigh;
32
33
  attribute vec3 a_startPosLow;
33
34
  attribute vec3 a_endPosHigh;
34
35
  attribute vec3 a_endPosLow;
36
+ attribute vec2 a_vertices;
35
37
  attribute float a_thickness;
36
- attribute vec4 a_rgba;
37
38
 
38
39
  varying vec4 v_rgba;
39
40
 
@@ -48,38 +49,31 @@ export function rayScreen() {
48
49
 
49
50
  v_rgba = vec4(a_rgba.rgb, a_rgba.a * uOpacity);
50
51
 
51
- vec3 camPos = eyePositionHigh + eyePositionLow;
52
-
53
- vec3 startPos = a_startPosHigh + a_startPosLow;
54
- float length = length((a_endPosHigh + a_endPosLow) - startPos);
55
- vec3 direction = normalize((a_endPosHigh + a_endPosLow) - startPos);
56
- vec3 vertPos = startPos + a_vertices.y * direction * length;
52
+ vec3 v = (a_endPosHigh - a_startPosHigh) + (a_endPosLow - a_startPosLow);
57
53
 
58
- vec3 look = vertPos - camPos;
59
- vec3 up = normalize(direction);
54
+ vec3 look = (a_startPosHigh - eyePositionHigh) + (a_startPosLow - eyePositionLow) + v * a_vertices.y;
55
+ vec3 up = normalize(normalize(v));
60
56
  vec3 right = normalize(cross(look,up));
61
57
 
62
- float dist = dot(camPos - vertPos, vec3(viewMatrix[0][2], viewMatrix[1][2], viewMatrix[2][2]));
58
+ float dist = dot(look, vec3(viewMatrix[0][2], viewMatrix[1][2], viewMatrix[2][2]));
63
59
  float focalSize = 2.0 * dist * resolution;
64
- vec3 rr = right * a_thickness * focalSize * a_vertices.x;
60
+ vec3 vert = right * a_thickness * focalSize * a_vertices.x;
65
61
 
66
- vec3 highDiff = -eyePositionHigh;
67
- vec3 lowDiff = rr - eyePositionLow;
62
+ vec3 highDiff;
63
+ vec3 lowDiff;
68
64
 
69
65
  if(a_vertices.y == 0.0){
70
- highDiff += a_startPosHigh;
71
- lowDiff += a_startPosLow;
66
+ highDiff = a_startPosHigh - eyePositionHigh;
67
+ vert += a_startPosLow - eyePositionLow;
72
68
  }else{
73
- highDiff += a_endPosHigh;
74
- lowDiff += a_endPosLow;
69
+ highDiff = a_endPosHigh - eyePositionHigh;
70
+ vert += a_endPosLow - eyePositionLow;
75
71
  }
76
72
 
77
73
  mat4 viewMatrixRTE = viewMatrix;
78
74
  viewMatrixRTE[3] = vec4(0.0, 0.0, 0.0, 1.0);
79
-
80
- vec4 pos = viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
81
75
 
82
- gl_Position = projectionMatrix * pos;
76
+ gl_Position = projectionMatrix * viewMatrixRTE * vec4(highDiff + vert, 1.0);
83
77
  }`,
84
78
  fragmentShader:
85
79
  `precision highp float;
@@ -565,7 +565,7 @@ export function base64StringToBlog(string) {
565
565
  * Callback throttling
566
566
  * @param {any} func
567
567
  * @param {Number} limit
568
- * @param {Number} skip
568
+ * @param {boolean} [skip]
569
569
  */
570
570
  export function throttle(func, limit, skip) {
571
571
  let lastFunc;
package/types/Events.d.ts CHANGED
@@ -47,9 +47,10 @@ export class Events {
47
47
  * @public
48
48
  * @param {string} name - Event name to listen.
49
49
  * @param {eventCallback} callback - Event callback function.
50
- * @param {Object} sender - Event callback function owner.
50
+ * @param {any} [sender] - Event callback function owner.
51
+ * @param {number} [priority] - Priority of event callback.
51
52
  */
52
- public on(name: string, callback: eventCallback, sender: any, priority?: number): void;
53
+ public on(name: string, callback: eventCallback, sender?: any, priority?: number): void;
53
54
  /**
54
55
  * Stop listening event name with specified callback function.
55
56
  * @public
@@ -42,8 +42,13 @@ declare class Touch {
42
42
  prev_y: number;
43
43
  grabbedPoint: Vec3;
44
44
  grabbedSpheroid: Sphere;
45
- dX: () => number;
46
- dY: () => number;
45
+ _vec: Vec2;
46
+ _vecPrev: Vec2;
47
+ get dY(): number;
48
+ get dX(): number;
49
+ get vec(): Vec2;
50
+ get vecPrev(): Vec2;
47
51
  }
48
52
  import { Key } from "../Lock.js";
53
+ import { Vec2 } from "../math/index.js";
49
54
  export {};
@@ -465,9 +465,9 @@ export class Planet extends RenderNode {
465
465
  * @public
466
466
  * @param {Vec2} px - Pixel screen 2d coordinates.
467
467
  * @param {Boolean} [force=false] - Force framebuffer rendering.
468
- * @returns {Vec3} -
468
+ * @returns {Vec3 | null} -
469
469
  */
470
- public getCartesianFromPixelTerrain(px: Vec2): Vec3;
470
+ public getCartesianFromPixelTerrain(px: Vec2): Vec3 | null;
471
471
  /**
472
472
  * Returns geographical coordinates on the relief planet by 2d screen coordinates.
473
473
  * position or null if input coordinates is outside the planet.
@@ -113,9 +113,9 @@ export function base64StringToBlog(string: any): Blob;
113
113
  * Callback throttling
114
114
  * @param {any} func
115
115
  * @param {Number} limit
116
- * @param {Number} skip
116
+ * @param {boolean} [skip]
117
117
  */
118
- export function throttle(func: any, limit: number, skip: number): (...args: any[]) => void;
118
+ export function throttle(func: any, limit: number, skip?: boolean): (...args: any[]) => void;
119
119
  /**
120
120
  *
121
121
  * y2-----Q12--------------Q22---