@openglobus/og 0.22.2 → 0.24.0

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 (205) hide show
  1. package/css/og.css +137 -1
  2. package/lib/@openglobus/js/Globe.d.ts +0 -1
  3. package/lib/@openglobus/js/Object3d.d.ts +20 -10
  4. package/lib/@openglobus/js/camera/Camera.d.ts +57 -15
  5. package/lib/@openglobus/js/camera/Frustum.d.ts +3 -0
  6. package/lib/@openglobus/js/camera/PlanetCamera.d.ts +13 -0
  7. package/lib/@openglobus/js/control/CameraLock.d.ts +38 -0
  8. package/lib/@openglobus/js/control/MouseNavigation.d.ts +62 -51
  9. package/lib/@openglobus/js/control/OldMouseNavigation.d.ts +64 -0
  10. package/lib/@openglobus/js/control/SimpleNavigation.d.ts +27 -10
  11. package/lib/@openglobus/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
  12. package/lib/@openglobus/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
  13. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
  14. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
  15. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
  16. package/lib/@openglobus/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
  17. package/lib/@openglobus/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
  18. package/lib/@openglobus/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
  19. package/lib/@openglobus/js/control/geoObjectEditor/colors.d.ts +8 -0
  20. package/lib/@openglobus/js/control/index.d.ts +3 -2
  21. package/lib/@openglobus/js/entity/Entity.d.ts +282 -19
  22. package/lib/@openglobus/js/entity/EntityCollection.d.ts +8 -9
  23. package/lib/@openglobus/js/entity/GeoObject.d.ts +135 -39
  24. package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +39 -63
  25. package/lib/@openglobus/js/entity/InstanceData.d.ts +76 -0
  26. package/lib/@openglobus/js/entity/Polyline.d.ts +19 -6
  27. package/lib/@openglobus/js/entity/PolylineHandler.d.ts +7 -0
  28. package/lib/@openglobus/js/index.d.ts +2 -1
  29. package/lib/@openglobus/js/input/MouseHandler.d.ts +1 -0
  30. package/lib/@openglobus/js/layer/Vector.d.ts +4 -0
  31. package/lib/@openglobus/js/light/LightSource.d.ts +1 -139
  32. package/lib/@openglobus/js/math/Mat3.d.ts +1 -1
  33. package/lib/@openglobus/js/math/Mat4.d.ts +10 -1
  34. package/lib/@openglobus/js/math/Plane.d.ts +3 -1
  35. package/lib/@openglobus/js/math/Quat.d.ts +47 -33
  36. package/lib/@openglobus/js/math/Ray.d.ts +10 -14
  37. package/lib/@openglobus/js/math/Vec2.d.ts +22 -0
  38. package/lib/@openglobus/js/math/Vec3.d.ts +15 -0
  39. package/lib/@openglobus/js/math.d.ts +2 -2
  40. package/lib/@openglobus/js/quadTree/EntityCollectionNode.d.ts +2 -2
  41. package/lib/@openglobus/js/quadTree/Node.d.ts +1 -1
  42. package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
  43. package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
  44. package/lib/@openglobus/js/renderer/Renderer.d.ts +63 -44
  45. package/lib/@openglobus/js/renderer/RendererEvents.d.ts +2 -0
  46. package/lib/@openglobus/js/scene/Planet.d.ts +15 -7
  47. package/lib/@openglobus/js/scene/RenderNode.d.ts +10 -25
  48. package/lib/@openglobus/js/shaders/drawnode.d.ts +1 -0
  49. package/lib/@openglobus/js/shaders/geoObject.d.ts +1 -0
  50. package/lib/@openglobus/js/shaders/utils.d.ts +1 -1
  51. package/lib/@openglobus/js/ui/Checkbox.d.ts +31 -0
  52. package/lib/@openglobus/js/ui/Dialog.d.ts +3 -0
  53. package/lib/@openglobus/js/ui/Input.d.ts +32 -0
  54. package/lib/@openglobus/js/ui/View.d.ts +3 -1
  55. package/lib/@openglobus/js/utils/objParser.d.ts +44 -12
  56. package/lib/@openglobus/js/utils/shared.d.ts +22 -0
  57. package/lib/@openglobus/js/webgl/BaseFramebuffer.d.ts +0 -1
  58. package/lib/@openglobus/js/webgl/Framebuffer.d.ts +35 -8
  59. package/lib/@openglobus/js/webgl/Handler.d.ts +22 -12
  60. package/lib/@openglobus/og.css +1 -1
  61. package/lib/@openglobus/og.esm.js +1 -1
  62. package/lib/@openglobus/og.esm.js.map +1 -1
  63. package/lib/@openglobus/og.umd.js +1 -1
  64. package/lib/@openglobus/og.umd.js.map +1 -1
  65. package/lib/js/Globe.d.ts +0 -1
  66. package/lib/js/Globe.js +4 -2
  67. package/lib/js/Object3d.d.ts +20 -10
  68. package/lib/js/Object3d.js +124 -48
  69. package/lib/js/Popup.js +1 -1
  70. package/lib/js/camera/Camera.d.ts +57 -15
  71. package/lib/js/camera/Camera.js +109 -29
  72. package/lib/js/camera/Frustum.d.ts +3 -0
  73. package/lib/js/camera/Frustum.js +7 -0
  74. package/lib/js/camera/PlanetCamera.d.ts +13 -0
  75. package/lib/js/camera/PlanetCamera.js +52 -5
  76. package/lib/js/control/Atmosphere.js +10 -6
  77. package/lib/js/control/CameraLock.d.ts +38 -0
  78. package/lib/js/control/CameraLock.js +216 -0
  79. package/lib/js/control/Control.js +1 -1
  80. package/lib/js/control/DebugInfo.js +38 -8
  81. package/lib/js/control/KeyboardNavigation.js +9 -9
  82. package/lib/js/control/MouseNavigation.d.ts +62 -51
  83. package/lib/js/control/MouseNavigation.js +361 -305
  84. package/lib/js/control/MouseWheelZoomControl.d.ts +0 -44
  85. package/lib/js/control/MouseWheelZoomControl.js +270 -181
  86. package/lib/js/control/OldMouseNavigation.d.ts +64 -0
  87. package/lib/js/control/OldMouseNavigation.js +368 -0
  88. package/lib/js/control/ScaleControl.js +11 -5
  89. package/lib/js/control/SimpleNavigation.d.ts +27 -10
  90. package/lib/js/control/SimpleNavigation.js +149 -49
  91. package/lib/js/control/Sun.js +6 -6
  92. package/lib/js/control/TouchNavigation.js +11 -8
  93. package/lib/js/control/elevationProfile/ElevationProfileScene.js +6 -5
  94. package/lib/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
  95. package/lib/js/control/geoObjectEditor/ArrowEntity.js +59 -0
  96. package/lib/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
  97. package/lib/js/control/geoObjectEditor/AxisTrackEntity.js +93 -0
  98. package/lib/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
  99. package/lib/js/control/geoObjectEditor/GeoObjectEditor.js +30 -0
  100. package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
  101. package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.js +488 -0
  102. package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
  103. package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.js +487 -43
  104. package/lib/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
  105. package/lib/js/control/geoObjectEditor/MoveAxisEntity.js +107 -0
  106. package/lib/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
  107. package/lib/js/control/geoObjectEditor/MovePlaneEntity.js +31 -0
  108. package/lib/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
  109. package/lib/js/control/geoObjectEditor/RotateEntity.js +105 -0
  110. package/lib/js/control/geoObjectEditor/colors.d.ts +8 -0
  111. package/lib/js/control/geoObjectEditor/colors.js +8 -0
  112. package/lib/js/control/index.d.ts +3 -2
  113. package/lib/js/control/index.js +3 -2
  114. package/lib/js/control/timeline/TimelineControl.js +2 -0
  115. package/lib/js/control/visibleExtent/Segment.js +4 -4
  116. package/lib/js/entity/Entity.d.ts +282 -19
  117. package/lib/js/entity/Entity.js +497 -62
  118. package/lib/js/entity/EntityCollection.d.ts +8 -9
  119. package/lib/js/entity/EntityCollection.js +48 -45
  120. package/lib/js/entity/GeoObject.d.ts +135 -39
  121. package/lib/js/entity/GeoObject.js +150 -90
  122. package/lib/js/entity/GeoObjectHandler.d.ts +39 -63
  123. package/lib/js/entity/GeoObjectHandler.js +198 -295
  124. package/lib/js/entity/InstanceData.d.ts +76 -0
  125. package/lib/js/entity/InstanceData.js +347 -0
  126. package/lib/js/entity/Polyline.d.ts +19 -6
  127. package/lib/js/entity/Polyline.js +76 -36
  128. package/lib/js/entity/PolylineHandler.d.ts +7 -0
  129. package/lib/js/entity/PolylineHandler.js +26 -1
  130. package/lib/js/index.d.ts +2 -1
  131. package/lib/js/index.js +2 -1
  132. package/lib/js/input/MouseHandler.d.ts +1 -0
  133. package/lib/js/input/MouseHandler.js +12 -1
  134. package/lib/js/layer/Bing.js +2 -2
  135. package/lib/js/layer/Vector.d.ts +4 -0
  136. package/lib/js/layer/Vector.js +16 -0
  137. package/lib/js/light/LightSource.d.ts +1 -139
  138. package/lib/js/light/LightSource.js +21 -227
  139. package/lib/js/math/Mat3.d.ts +1 -1
  140. package/lib/js/math/Mat3.js +1 -1
  141. package/lib/js/math/Mat4.d.ts +10 -1
  142. package/lib/js/math/Mat4.js +17 -1
  143. package/lib/js/math/Plane.d.ts +3 -1
  144. package/lib/js/math/Plane.js +11 -1
  145. package/lib/js/math/Quat.d.ts +47 -33
  146. package/lib/js/math/Quat.js +92 -90
  147. package/lib/js/math/Ray.d.ts +10 -14
  148. package/lib/js/math/Ray.js +56 -33
  149. package/lib/js/math/Vec2.d.ts +22 -0
  150. package/lib/js/math/Vec2.js +32 -0
  151. package/lib/js/math/Vec3.d.ts +15 -0
  152. package/lib/js/math/Vec3.js +30 -1
  153. package/lib/js/math.d.ts +2 -2
  154. package/lib/js/math.js +3 -3
  155. package/lib/js/quadTree/EntityCollectionNode.d.ts +2 -2
  156. package/lib/js/quadTree/EntityCollectionNode.js +8 -8
  157. package/lib/js/quadTree/Node.d.ts +1 -1
  158. package/lib/js/quadTree/Node.js +2 -2
  159. package/lib/js/quadTree/QuadTreeStrategy.js +1 -1
  160. package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
  161. package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.js +2 -2
  162. package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
  163. package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.js +2 -2
  164. package/lib/js/renderer/Renderer.d.ts +63 -44
  165. package/lib/js/renderer/Renderer.js +267 -266
  166. package/lib/js/renderer/RendererEvents.d.ts +2 -0
  167. package/lib/js/renderer/RendererEvents.js +5 -2
  168. package/lib/js/scene/Planet.d.ts +15 -7
  169. package/lib/js/scene/Planet.js +133 -90
  170. package/lib/js/scene/RenderNode.d.ts +10 -25
  171. package/lib/js/scene/RenderNode.js +70 -58
  172. package/lib/js/segment/Segment.js +4 -4
  173. package/lib/js/shaders/depth.js +2 -5
  174. package/lib/js/shaders/drawnode.d.ts +1 -0
  175. package/lib/js/shaders/drawnode.js +51 -52
  176. package/lib/js/shaders/geoObject.d.ts +1 -0
  177. package/lib/js/shaders/geoObject.js +154 -91
  178. package/lib/js/shaders/polyline.js +68 -51
  179. package/lib/js/shaders/utils.d.ts +1 -1
  180. package/lib/js/shaders/utils.js +11 -0
  181. package/lib/js/terrain/GlobusTerrain.js +2 -2
  182. package/lib/js/ui/Checkbox.d.ts +31 -0
  183. package/lib/js/ui/Checkbox.js +110 -0
  184. package/lib/js/ui/Color.js +2 -1
  185. package/lib/js/ui/Dialog.d.ts +3 -0
  186. package/lib/js/ui/Dialog.js +20 -0
  187. package/lib/js/ui/Input.d.ts +32 -0
  188. package/lib/js/ui/Input.js +107 -0
  189. package/lib/js/ui/View.d.ts +3 -1
  190. package/lib/js/ui/View.js +6 -0
  191. package/lib/js/utils/objParser.d.ts +44 -12
  192. package/lib/js/utils/objParser.js +241 -149
  193. package/lib/js/utils/shared.d.ts +22 -0
  194. package/lib/js/utils/shared.js +34 -0
  195. package/lib/js/webgl/BaseFramebuffer.d.ts +0 -1
  196. package/lib/js/webgl/Framebuffer.d.ts +35 -8
  197. package/lib/js/webgl/Framebuffer.js +136 -29
  198. package/lib/js/webgl/Handler.d.ts +22 -12
  199. package/lib/js/webgl/Handler.js +53 -34
  200. package/lib/js/webgl/Program.js +0 -8
  201. package/package.json +5 -3
  202. package/lib/@openglobus/js/control/EarthNavigation.d.ts +0 -50
  203. package/lib/@openglobus/js/control/MouseWheelZoomControl.d.ts +0 -44
  204. package/lib/js/control/EarthNavigation.d.ts +0 -50
  205. package/lib/js/control/EarthNavigation.js +0 -202
@@ -241,6 +241,13 @@ export declare class Vec3 {
241
241
  * @returns {Vec3} Returns a sum vector.
242
242
  */
243
243
  add(p: Vec3): Vec3;
244
+ /**
245
+ * Gets two vectors summarization.
246
+ * @public
247
+ * @param {Vec3} p - Vector to add.
248
+ * @returns {Vec3} Returns a sum vector.
249
+ */
250
+ addRes(p: Vec3, res: Vec3): Vec3;
244
251
  /**
245
252
  * Subtract vector from the current.
246
253
  * @public
@@ -283,6 +290,13 @@ export declare class Vec3 {
283
290
  * @returns {Vec3} -
284
291
  */
285
292
  mul(vec: Vec3): Vec3;
293
+ /**
294
+ * Multiply current vector object to another and returns new vector instance.
295
+ * @public
296
+ * @param {Vec3} vec - Multiply vector.
297
+ * @returns {Vec3} -
298
+ */
299
+ mulRes(vec: Vec3, res: Vec3): Vec3;
286
300
  /**
287
301
  * Divide current vector's components to another. Results stores in the current vector object.
288
302
  * @public
@@ -452,6 +466,7 @@ export declare class Vec3 {
452
466
  * @returns {Vec3} -
453
467
  */
454
468
  slerp(v2: Vec3, t: number): Vec3;
469
+ mulVecA(a: Vec3): Vec3;
455
470
  /**
456
471
  * Gets the shortest arc quaternion to rotate this vector to the destination vector.
457
472
  * @param {Vec3} dest -
@@ -155,7 +155,12 @@ export class Vec3 {
155
155
  * @returns {number} -
156
156
  */
157
157
  static angle(a, b) {
158
- return Math.acos(a.dot(b) / Math.sqrt(a.length2() * b.length2()));
158
+ // the same
159
+ // let d = a.dot(b) / Math.sqrt(a.length2() * b.length2());
160
+ // return Math.acos(Math.max(-1, Math.min(1, d)));
161
+ let dotProduct = a.dot(b);
162
+ let crossProduct = a.cross(b).length();
163
+ return Math.atan2(crossProduct, dotProduct);
159
164
  }
160
165
  /**
161
166
  * Returns two vectors linear interpolation.
@@ -389,6 +394,15 @@ export class Vec3 {
389
394
  add(p) {
390
395
  return new Vec3(this.x + p.x, this.y + p.y, this.z + p.z);
391
396
  }
397
+ /**
398
+ * Gets two vectors summarization.
399
+ * @public
400
+ * @param {Vec3} p - Vector to add.
401
+ * @returns {Vec3} Returns a sum vector.
402
+ */
403
+ addRes(p, res) {
404
+ return res.set(this.x + p.x, this.y + p.y, this.z + p.z);
405
+ }
392
406
  /**
393
407
  * Subtract vector from the current.
394
408
  * @public
@@ -452,6 +466,15 @@ export class Vec3 {
452
466
  mul(vec) {
453
467
  return new Vec3(this.x * vec.x, this.y * vec.y, this.z * vec.z);
454
468
  }
469
+ /**
470
+ * Multiply current vector object to another and returns new vector instance.
471
+ * @public
472
+ * @param {Vec3} vec - Multiply vector.
473
+ * @returns {Vec3} -
474
+ */
475
+ mulRes(vec, res) {
476
+ return res.set(this.x * vec.x, this.y * vec.y, this.z * vec.z);
477
+ }
455
478
  /**
456
479
  * Divide current vector's components to another. Results stores in the current vector object.
457
480
  * @public
@@ -741,6 +764,12 @@ export class Vec3 {
741
764
  }
742
765
  return Vec3.add(this.scaleTo(scale0), v2.scale(scale1));
743
766
  }
767
+ mulVecA(a) {
768
+ this.x *= a.x;
769
+ this.y *= a.y;
770
+ this.z *= a.z;
771
+ return this;
772
+ }
744
773
  /**
745
774
  * Gets the shortest arc quaternion to rotate this vector to the destination vector.
746
775
  * @param {Vec3} dest -
package/lib/js/math.d.ts CHANGED
@@ -70,7 +70,7 @@ export declare function log(n: number, base: number): number;
70
70
  /**
71
71
  * Clamp the number.
72
72
  * @function
73
- * @param {number} number - Input number.
73
+ * @param {number} value - Input number.
74
74
  * @param {number} min - Minimal edge.
75
75
  * @param {number} max - Maximal edge.
76
76
  * @returns {number} -
@@ -78,7 +78,7 @@ export declare function log(n: number, base: number): number;
78
78
  * clamp(12, 1, 5)
79
79
  * //returns 5
80
80
  */
81
- export declare function clamp(number: number, min: number, max: number): number;
81
+ export declare function clamp(value: number, min: number, max: number): number;
82
82
  /**
83
83
  * Converts degrees value to radians.
84
84
  * @function
package/lib/js/math.js CHANGED
@@ -71,7 +71,7 @@ export function log(n, base) {
71
71
  /**
72
72
  * Clamp the number.
73
73
  * @function
74
- * @param {number} number - Input number.
74
+ * @param {number} value - Input number.
75
75
  * @param {number} min - Minimal edge.
76
76
  * @param {number} max - Maximal edge.
77
77
  * @returns {number} -
@@ -79,8 +79,8 @@ export function log(n, base) {
79
79
  * clamp(12, 1, 5)
80
80
  * //returns 5
81
81
  */
82
- export function clamp(number, min, max) {
83
- return Math.max(min, Math.min(number, max));
82
+ export function clamp(value, min, max) {
83
+ return Math.max(min, Math.min(value, max));
84
84
  }
85
85
  /**
86
86
  * Converts degrees value to radians.
@@ -16,7 +16,7 @@ declare class EntityCollectionNode {
16
16
  layer: Vector;
17
17
  strategy: EntityCollectionsTreeStrategy;
18
18
  parentNode: EntityCollectionNode | null;
19
- childrenNodes: EntityCollectionNode[];
19
+ childNodes: EntityCollectionNode[];
20
20
  partId: number;
21
21
  nodeId: number;
22
22
  state: number | null;
@@ -34,7 +34,7 @@ declare class EntityCollectionNode {
34
34
  __setLonLat__(entity: Entity): LonLat;
35
35
  buildTree(entities: Entity[], rightNow?: boolean): void;
36
36
  isInside(entity: Entity): boolean;
37
- createChildrenNodes(): void;
37
+ createChildNodes(): void;
38
38
  collectRenderCollectionsPASS1(visibleNodes: NodesDict, outArr: EntityCollection[]): void;
39
39
  collectRenderCollectionsPASS2(visibleNodes: NodesDict, outArr: EntityCollection[], renderingNodeId: number): void;
40
40
  applyCollection(): void;
@@ -13,7 +13,7 @@ class EntityCollectionNode {
13
13
  this.strategy = strategy;
14
14
  this.layer = strategy._layer;
15
15
  this.parentNode = parent;
16
- this.childrenNodes = [];
16
+ this.childNodes = [];
17
17
  this.partId = partId;
18
18
  //this.nodeId = partId + id;
19
19
  this.nodeId = partId + (parent ? parent.nodeId * 4 + 1 : 0);
@@ -78,9 +78,9 @@ class EntityCollectionNode {
78
78
  buildTree(entities, rightNow = false) {
79
79
  this.count += entities.length;
80
80
  if (entities.length > this.layer._nodeCapacity) {
81
- const cn = this.childrenNodes;
81
+ const cn = this.childNodes;
82
82
  if (!cn.length) {
83
- this.createChildrenNodes();
83
+ this.createChildNodes();
84
84
  }
85
85
  let en_nw = [], en_ne = [], en_sw = [], en_se = [];
86
86
  let i = entities.length;
@@ -120,7 +120,7 @@ class EntityCollectionNode {
120
120
  return false;
121
121
  }
122
122
  }
123
- createChildrenNodes() {
123
+ createChildNodes() {
124
124
  const s = this.strategy;
125
125
  const ext = this.extent;
126
126
  const size_x = ext.getWidth() * 0.5;
@@ -128,7 +128,7 @@ class EntityCollectionNode {
128
128
  const ne = ext.northEast;
129
129
  const sw = ext.southWest;
130
130
  const c = new LonLat(sw.lon + size_x, sw.lat + size_y);
131
- const nd = this.childrenNodes;
131
+ const nd = this.childNodes;
132
132
  const p = this.layer._planet;
133
133
  const z = this.zoom + 1;
134
134
  nd[NW] = new EntityCollectionNode(s, NW, this, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)), p, z);
@@ -139,7 +139,7 @@ class EntityCollectionNode {
139
139
  collectRenderCollectionsPASS1(visibleNodes, outArr) {
140
140
  const n = visibleNodes[this.nodeId];
141
141
  if (n) {
142
- const cn = this.childrenNodes;
142
+ const cn = this.childNodes;
143
143
  if (this.entityCollection) {
144
144
  this.renderCollection(outArr, visibleNodes);
145
145
  }
@@ -162,7 +162,7 @@ class EntityCollectionNode {
162
162
  const altVis = (cam.eye.distance(this.bsphere.center) - this.bsphere.radius <
163
163
  VISIBLE_DISTANCE * Math.sqrt(cam._lonLat.height)) || cam._lonLat.height > 10000;
164
164
  if (this.count > 0 && altVis && cam.containsSphere(this.bsphere)) {
165
- const cn = this.childrenNodes;
165
+ const cn = this.childNodes;
166
166
  if (this.entityCollection) {
167
167
  this.renderCollection(outArr, visibleNodes, renderingNodeId);
168
168
  }
@@ -181,7 +181,7 @@ class EntityCollectionNode {
181
181
  this._inTheQueue = false;
182
182
  }
183
183
  traverseTree(callback) {
184
- const cn = this.childrenNodes;
184
+ const cn = this.childNodes;
185
185
  if (this.entityCollection) {
186
186
  callback(this);
187
187
  }
@@ -33,7 +33,7 @@ declare class Node {
33
33
  inFrustum: number;
34
34
  _fadingNodes: Node[];
35
35
  constructor(SegmentPrototype: typeof Segment, planet: Planet, partId: number, parent: Node | null, tileZoom: number, extent: Extent);
36
- createChildrenNodes(): void;
36
+ createChildNodes(): void;
37
37
  createBounds(): void;
38
38
  getState(): number | null;
39
39
  /**
@@ -53,7 +53,7 @@ class Node {
53
53
  this._fadingNodes = [];
54
54
  this.createBounds();
55
55
  }
56
- createChildrenNodes() {
56
+ createChildNodes() {
57
57
  this.ready = true;
58
58
  const p = this.planet;
59
59
  const ps = this.segment;
@@ -137,7 +137,7 @@ class Node {
137
137
  // }
138
138
  traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode) {
139
139
  if (!this.ready) {
140
- this.createChildrenNodes();
140
+ this.createChildNodes();
141
141
  }
142
142
  let n = this.nodes;
143
143
  n[0].renderTree(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode);
@@ -40,7 +40,7 @@ export class QuadTreeStrategy {
40
40
  preRender() {
41
41
  for (let i = 0; i < this._quadTreeList.length; i++) {
42
42
  let quadTree = this._quadTreeList[i];
43
- quadTree.createChildrenNodes();
43
+ quadTree.createChildNodes();
44
44
  quadTree.segment.createPlainSegment();
45
45
  for (let j = 0; j < quadTree.nodes.length; j++) {
46
46
  quadTree.nodes[j].segment.createPlainSegment();
@@ -9,7 +9,7 @@ export declare class EarthEntityCollectionNodeLonLat extends EntityCollectionNod
9
9
  isNorth: boolean;
10
10
  strategy: EarthEntityCollectionsTreeStrategy;
11
11
  constructor(strategy: EarthEntityCollectionsTreeStrategy, partId: number, parent: EarthEntityCollectionNodeLonLat | null, extent: Extent, planet: Planet, zoom: number);
12
- createChildrenNodes(): void;
12
+ createChildNodes(): void;
13
13
  protected _setExtentBounds(): void;
14
14
  __setLonLat__(entity: Entity): LonLat;
15
15
  isVisible(): boolean;
@@ -8,7 +8,7 @@ export class EarthEntityCollectionNodeLonLat extends EntityCollectionNode {
8
8
  this.strategy = strategy;
9
9
  this.isNorth = false;
10
10
  }
11
- createChildrenNodes() {
11
+ createChildNodes() {
12
12
  const s = this.strategy;
13
13
  const ext = this.extent;
14
14
  const size_x = ext.getWidth() * 0.5;
@@ -16,7 +16,7 @@ export class EarthEntityCollectionNodeLonLat extends EntityCollectionNode {
16
16
  const ne = ext.northEast;
17
17
  const sw = ext.southWest;
18
18
  const c = new LonLat(sw.lon + size_x, sw.lat + size_y);
19
- const nd = this.childrenNodes;
19
+ const nd = this.childNodes;
20
20
  const p = this.layer._planet;
21
21
  const z = this.zoom + 1;
22
22
  nd[NW] = new EarthEntityCollectionNodeLonLat(s, NW, this, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)), p, z);
@@ -8,7 +8,7 @@ import { EquiEntityCollectionsTreeStrategy } from "./EquiEntityCollectionsTreeSt
8
8
  export declare class EquiEntityCollectionNodeLonLat extends EntityCollectionNode {
9
9
  strategy: EquiEntityCollectionsTreeStrategy;
10
10
  constructor(strategy: EquiEntityCollectionsTreeStrategy, partId: number, parent: EquiEntityCollectionNodeLonLat | null, extent: Extent, planet: Planet, zoom: number);
11
- createChildrenNodes(): void;
11
+ createChildNodes(): void;
12
12
  protected _setExtentBounds(): void;
13
13
  __setLonLat__(entity: Entity): LonLat;
14
14
  isVisible(): boolean;
@@ -7,7 +7,7 @@ export class EquiEntityCollectionNodeLonLat extends EntityCollectionNode {
7
7
  super(strategy, partId, parent, extent, planet, zoom);
8
8
  this.strategy = strategy;
9
9
  }
10
- createChildrenNodes() {
10
+ createChildNodes() {
11
11
  const s = this.strategy;
12
12
  const ext = this.extent;
13
13
  const size_x = ext.getWidth() * 0.5;
@@ -15,7 +15,7 @@ export class EquiEntityCollectionNodeLonLat extends EntityCollectionNode {
15
15
  const ne = ext.northEast;
16
16
  const sw = ext.southWest;
17
17
  const c = new LonLat(sw.lon + size_x, sw.lat + size_y);
18
- const nd = this.childrenNodes;
18
+ const nd = this.childNodes;
19
19
  const p = this.layer._planet;
20
20
  const z = this.zoom + 1;
21
21
  nd[NW] = new EquiEntityCollectionNodeLonLat(s, NW, this, new Extent(new LonLat(sw.lon, sw.lat + size_y), new LonLat(sw.lon + size_x, ne.lat)), p, z);
@@ -1,6 +1,6 @@
1
1
  import { Camera } from "../camera/Camera";
2
2
  import { Control } from "../control/Control";
3
- import { RendererEventsHandler } from "./RendererEvents";
3
+ import { IBaseInputState, RendererEventsHandler } from "./RendererEvents";
4
4
  import { EntityCollection } from "../entity/EntityCollection";
5
5
  import { Framebuffer, Multisample } from "../webgl/index";
6
6
  import { FontAtlas } from "../utils/FontAtlas";
@@ -18,6 +18,7 @@ interface IRendererParams {
18
18
  fontsSrc?: string;
19
19
  gamma?: number;
20
20
  exposure?: number;
21
+ dpi?: number;
21
22
  }
22
23
  interface IPickingObject {
23
24
  _pickingColor?: Vec3;
@@ -28,6 +29,39 @@ interface IFrameCallbackHandler {
28
29
  callback: Function;
29
30
  sender: any;
30
31
  }
32
+ /**
33
+ * Represents high level WebGL context interface that starts WebGL handler working in real time.
34
+ * @class
35
+ * @param {Handler} handler - WebGL handler context.
36
+ * @param {Object} [params] - Renderer parameters:
37
+ * @fires EventsHandler<RendererEventsType>#draw
38
+ * @fires EventsHandler<RendererEventsType>#resize
39
+ * @fires EventsHandler<RendererEventsType>#mousemove
40
+ * @fires EventsHandler<RendererEventsType>#mousestop
41
+ * @fires EventsHandler<RendererEventsType>#lclick
42
+ * @fires EventsHandler<RendererEventsType>#rclick
43
+ * @fires EventsHandler<RendererEventsType>#mclick
44
+ * @fires EventsHandler<RendererEventsType>#ldblclick
45
+ * @fires EventsHandler<RendererEventsType>#rdblclick
46
+ * @fires EventsHandler<RendererEventsType>#mdblclick
47
+ * @fires EventsHandler<RendererEventsType>#lup
48
+ * @fires EventsHandler<RendererEventsType>#rup
49
+ * @fires EventsHandler<RendererEventsType>#mup
50
+ * @fires EventsHandler<RendererEventsType>#ldown
51
+ * @fires EventsHandler<RendererEventsType>#rdown
52
+ * @fires EventsHandler<RendererEventsType>#mdown
53
+ * @fires EventsHandler<RendererEventsType>#lhold
54
+ * @fires EventsHandler<RendererEventsType>#rhold
55
+ * @fires EventsHandler<RendererEventsType>#mhold
56
+ * @fires EventsHandler<RendererEventsType>#mousewheel
57
+ * @fires EventsHandler<RendererEventsType>#touchstart
58
+ * @fires EventsHandler<RendererEventsType>#touchend
59
+ * @fires EventsHandler<RendererEventsType>#touchcancel
60
+ * @fires EventsHandler<RendererEventsType>#touchmove
61
+ * @fires EventsHandler<RendererEventsType>#doubletouch
62
+ * @fires EventsHandler<RendererEventsType>#touchleave
63
+ * @fires EventsHandler<RendererEventsType>#touchenter
64
+ */
31
65
  export interface HTMLDivElementExt extends HTMLDivElement {
32
66
  attributions?: HTMLElement;
33
67
  }
@@ -65,7 +99,7 @@ declare class Renderer {
65
99
  * @public
66
100
  * @type {Camera}
67
101
  */
68
- activeCamera: Camera | null;
102
+ activeCamera: Camera;
69
103
  /**
70
104
  * Renderer events. Represents interface for setting events like mousemove, draw, keypress etc.
71
105
  * @public
@@ -101,17 +135,6 @@ declare class Renderer {
101
135
  * @type {Framebuffer}
102
136
  */
103
137
  pickingFramebuffer: Framebuffer | null;
104
- protected _tempPickingPix_: Uint8Array;
105
- /**
106
- * @public
107
- * @type {Framebuffer}
108
- */
109
- distanceFramebuffer: Framebuffer | null;
110
- /**
111
- * @type {Function[]}
112
- */
113
- protected _distanceCallbacks: IFrameCallbackHandler[];
114
- protected _tempDistancePix_: Uint8Array;
115
138
  /**
116
139
  * Depth objects rendering queue.
117
140
  * @type {Function[]}
@@ -144,24 +167,19 @@ declare class Renderer {
144
167
  * @type {FontAtlas}
145
168
  */
146
169
  fontAtlas: FontAtlas;
147
- protected _entityCollections: EntityCollection[];
170
+ protected _entityCollections: EntityCollection[][];
148
171
  protected _currentOutput: string;
149
172
  protected _fnScreenFrame: Function | null;
150
173
  labelWorker: LabelWorker;
151
- __useDistanceFramebuffer__: boolean;
152
174
  screenDepthFramebuffer: Framebuffer | null;
153
175
  screenFramePositionBuffer: WebGLBufferExt | null;
154
176
  screenTexture: Record<string, WebGLTexture>;
155
177
  outputTexture: WebGLTexture | null;
156
- protected _skipDistanceFrame: boolean;
157
- protected _distancePixelBuffer: WebGLBuffer | null;
158
- protected _skipPickingFrame: boolean;
159
- protected _pickingPixelBuffer: WebGLBuffer | null;
160
- protected _readDistanceBuffer: () => void;
161
178
  protected _readPickingBuffer: () => void;
162
- constructor(handler: Handler, params?: IRendererParams);
179
+ constructor(handler: Handler | string | HTMLCanvasElement, params?: IRendererParams);
163
180
  enableBlendOneSrcAlpha(): void;
164
181
  enableBlendDefault(): void;
182
+ setRelativeCenter(c?: Vec3): void;
165
183
  /**
166
184
  * Sets renderer events activity.
167
185
  * @param {Boolean} activity - Events activity.
@@ -169,8 +187,6 @@ declare class Renderer {
169
187
  setEventsActivity(activity: boolean): void;
170
188
  addDepthCallback(sender: any, callback: Function): number;
171
189
  removeDepthCallback(id: number): void;
172
- addDistanceCallback(sender: any, callback: Function): number;
173
- removeDistanceCallback(id: number): void;
174
190
  /**
175
191
  * Adds picking rendering callback function.
176
192
  * @param {object} sender - Callback context.
@@ -243,7 +259,6 @@ declare class Renderer {
243
259
  * @public
244
260
  */
245
261
  initialize(): void;
246
- _initReadPixelsBuffers(): void;
247
262
  _initializeControls(): void;
248
263
  resize(): void;
249
264
  setCurrentScreen(screenName: string): void;
@@ -275,18 +290,14 @@ declare class Renderer {
275
290
  /**
276
291
  * TODO: replace with cache friendly linked list by BillboardHandler, LabelHandler etc.
277
292
  */
278
- enqueueEntityCollectionsToDraw(ecArr: EntityCollection[]): void;
279
- /**
280
- * Draws opaque items entity collections.
281
- * @protected
282
- */
283
- protected _drawOpaqueEntityCollections(): void;
293
+ enqueueEntityCollectionsToDraw(ecArr: EntityCollection[], depthOrder?: number): void;
284
294
  /**
285
- * Draws transparent items entity collections.
286
295
  * @protected
287
296
  */
288
- protected _drawTransparentEntityCollections(): void;
289
- protected _clearEntityCollectionQueue(): void;
297
+ protected _drawEntityCollections(depthOrder: number): void;
298
+ protected _drawPickingEntityCollections(depthOrder: number): void;
299
+ protected _drawDepthEntityCollections(depthOrder: number): void;
300
+ protected _clearEntityCollectionQueue(depthOrder: number): void;
290
301
  /**
291
302
  * Draw nodes.
292
303
  * @public
@@ -299,19 +310,27 @@ declare class Renderer {
299
310
  * Draw picking objects framebuffer.
300
311
  * @private
301
312
  */
302
- protected _drawPickingBuffer(): void;
313
+ protected _drawPickingBuffer(depthOrder: number): void;
314
+ protected _drawDepthBuffer(depthOrder: number): void;
315
+ protected _readDepthBuffer(): void;
316
+ protected _readPickingBuffer_webgl1(): void;
317
+ protected _readPickingBuffer_webgl2(): void;
318
+ readPickingColor(x: number, y: number, outColor: NumberArray3 | Uint8Array): void;
319
+ readDepth(x: number, y: number, outDepth: NumberArray3 | Float32Array): void;
303
320
  /**
304
- * Draw picking objects framebuffer.
305
- * @protected
321
+ * Returns the distance from the active (screen) camera to the 3d-surface using the defined screen coordinates
322
+ * @public
323
+ * @param {Vec2 | IBaseInputState} px - Screen coordinates.
324
+ * @returns {number | undefined} -
306
325
  */
307
- protected _drawDistanceBuffer(): void;
308
- protected _drawDepthBuffer(): void;
309
- protected _readPickingBuffer_webgl1: () => void;
310
- protected _readPickingBuffer_webgl2: () => void;
311
- protected _readDistanceBuffer_webgl1: () => void;
312
- protected _readDistanceBuffer_webgl2: () => void;
313
- readPickingColor(x: number, y: number, outColor: NumberArray3 | Uint8Array): void;
314
- readDistanceColor(x: number, y: number, outColor: NumberArray3 | Uint8Array): void;
326
+ getDistanceFromPixel(px: Vec2 | IBaseInputState, camera?: Camera | null): number | undefined;
327
+ /**
328
+ * Returns 3d coordinates from screen coordinates
329
+ * @public
330
+ * @param {Vec2 | IBaseInputState} px - Screen coordinates.
331
+ * @returns {Vec3 | undefined} -
332
+ */
333
+ getCartesianFromPixel(px: Vec2 | IBaseInputState): Vec3 | undefined;
315
334
  /**
316
335
  * Function starts renderer
317
336
  * @public