@openglobus/og 0.11.2 → 0.11.7

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 (273) hide show
  1. package/package.json +13 -13
  2. package/src/og/Clock.js +10 -10
  3. package/src/og/Events.js +8 -6
  4. package/src/og/Extent.js +82 -41
  5. package/src/og/Globe.js +25 -13
  6. package/src/og/ImageCanvas.js +22 -16
  7. package/src/og/LonLat.js +16 -13
  8. package/src/og/Popup.js +21 -14
  9. package/src/og/QueueArray.js +6 -2
  10. package/src/og/Rectangle.js +11 -6
  11. package/src/og/Stack.js +5 -2
  12. package/src/og/ajax.js +21 -33
  13. package/src/og/astro/astro.js +5 -5
  14. package/src/og/astro/earth.js +22 -16
  15. package/src/og/astro/jd.js +23 -18
  16. package/src/og/astro/orbit.js +13 -11
  17. package/src/og/astro/rotation.js +17 -8
  18. package/src/og/bv/Box.js +7 -3
  19. package/src/og/bv/Sphere.js +14 -11
  20. package/src/og/camera/Camera.js +51 -54
  21. package/src/og/camera/Frustum.js +29 -18
  22. package/src/og/camera/PlanetCamera.js +32 -23
  23. package/src/og/control/CompassButton.js +5 -1
  24. package/src/og/control/Control.js +12 -10
  25. package/src/og/control/DebugInfo.js +4 -1
  26. package/src/og/control/EarthCoordinates.js +54 -33
  27. package/src/og/control/KeyboardNavigation.js +10 -10
  28. package/src/og/control/LayerSwitcher.js +22 -21
  29. package/src/og/control/Lighting.js +34 -3
  30. package/src/og/control/MouseNavigation.js +1 -1
  31. package/src/og/control/ScaleControl.js +1 -1
  32. package/src/og/control/SegmentBoundVisualization.js +6 -7
  33. package/src/og/control/ShowFps.js +13 -8
  34. package/src/og/control/SimpleNavigation.js +6 -8
  35. package/src/og/control/Sun.js +25 -15
  36. package/src/og/control/ToggleWireframe.js +4 -4
  37. package/src/og/control/TouchNavigation.js +44 -33
  38. package/src/og/control/ZoomControl.js +41 -25
  39. package/src/og/ellipsoid/Ellipsoid.js +162 -66
  40. package/src/og/ellipsoid/wgs84.js +4 -4
  41. package/src/og/entity/BaseBillboard.js +100 -56
  42. package/src/og/entity/Billboard.js +14 -10
  43. package/src/og/entity/BillboardHandler.js +317 -60
  44. package/src/og/entity/Entity.js +100 -68
  45. package/src/og/entity/EntityCollection.js +70 -47
  46. package/src/og/entity/GeoObject.js +228 -0
  47. package/src/og/entity/GeoObjectHandler.js +910 -0
  48. package/src/og/entity/Geometry.js +27 -24
  49. package/src/og/entity/GeometryHandler.js +596 -124
  50. package/src/og/entity/Label.js +80 -49
  51. package/src/og/entity/LabelHandler.js +45 -244
  52. package/src/og/entity/LabelWorker.js +218 -0
  53. package/src/og/entity/Object3d.js +504 -0
  54. package/src/og/entity/PointCloud.js +80 -32
  55. package/src/og/entity/PointCloudHandler.js +8 -8
  56. package/src/og/entity/Polyline.js +16 -16
  57. package/src/og/entity/Ray.js +60 -27
  58. package/src/og/entity/Strip.js +77 -48
  59. package/src/og/entity/StripHandler.js +26 -26
  60. package/src/og/entity/index.js +8 -16
  61. package/src/og/layer/BaseGeoImage.js +54 -23
  62. package/src/og/layer/CanvasTiles.js +24 -24
  63. package/src/og/layer/GeoImage.js +9 -9
  64. package/src/og/layer/GeoVideo.js +3 -3
  65. package/src/og/layer/KML.js +63 -37
  66. package/src/og/layer/Layer.js +44 -21
  67. package/src/og/layer/Material.js +23 -20
  68. package/src/og/layer/Vector.js +114 -68
  69. package/src/og/layer/WMS.js +34 -17
  70. package/src/og/layer/XYZ.js +48 -46
  71. package/src/og/light/LightSource.js +46 -39
  72. package/src/og/math/Mat3.js +34 -22
  73. package/src/og/math/Mat4.js +603 -459
  74. package/src/og/math/Plane.js +21 -20
  75. package/src/og/math/Quat.js +182 -139
  76. package/src/og/math/Ray.js +38 -33
  77. package/src/og/math/Vec2.js +85 -75
  78. package/src/og/math/Vec3.js +142 -112
  79. package/src/og/math/Vec4.js +27 -31
  80. package/src/og/math/coder.js +10 -10
  81. package/src/og/math.js +12 -12
  82. package/src/og/proj/EPSG3857.js +4 -4
  83. package/src/og/proj/EPSG4326.js +4 -4
  84. package/src/og/proj/Proj.js +4 -6
  85. package/src/og/quadTree/Node.js +8 -8
  86. package/src/og/renderer/Renderer.js +59 -52
  87. package/src/og/renderer/RendererEvents.js +50 -27
  88. package/src/og/scene/BaseNode.js +7 -8
  89. package/src/og/scene/Planet.js +102 -103
  90. package/src/og/scene/RenderNode.js +28 -21
  91. package/src/og/segment/Segment.js +26 -21
  92. package/src/og/segment/SegmentLonLat.js +5 -5
  93. package/src/og/shaders/drawnode.js +135 -142
  94. package/src/og/shaders/geoObject.js +211 -0
  95. package/src/og/shaders/pointCloud.js +41 -41
  96. package/src/og/shaders/shape.js +12 -18
  97. package/src/og/shaders/skybox.js +36 -36
  98. package/src/og/shaders/toneMapping.js +1 -0
  99. package/src/og/shapes/BaseShape.js +126 -54
  100. package/src/og/shapes/Icosphere.js +29 -14
  101. package/src/og/shapes/Sphere.js +12 -15
  102. package/src/og/terrain/BilTerrain.js +1 -0
  103. package/src/og/terrain/EmptyTerrain.js +2 -2
  104. package/src/og/terrain/GlobusTerrain.js +9 -9
  105. package/src/og/utils/FontAtlas.js +6 -2
  106. package/src/og/utils/TextureAtlas.js +22 -24
  107. package/src/og/utils/VectorTileCreator.js +1 -3
  108. package/src/og/utils/shared.js +16 -16
  109. package/src/og/webgl/Framebuffer.js +88 -40
  110. package/src/og/webgl/Handler.js +243 -169
  111. package/src/og/webgl/Multisample.js +47 -19
  112. package/src/og/webgl/Program.js +79 -34
  113. package/src/og/webgl/ProgramController.js +17 -13
  114. package/src/og/webgl/callbacks.js +8 -8
  115. package/src/og/inherits.js +0 -8
  116. package/src/og/utils/polylabel.js +0 -176
  117. package/types/Clock.d.ts +0 -90
  118. package/types/Deferred.d.ts +0 -6
  119. package/types/Events.d.ts +0 -73
  120. package/types/Extent.d.ts +0 -166
  121. package/types/Globe.d.ts +0 -75
  122. package/types/ImageCanvas.d.ts +0 -121
  123. package/types/Lock.d.ts +0 -12
  124. package/types/LonLat.d.ts +0 -108
  125. package/types/Popup.d.ts +0 -38
  126. package/types/QueueArray.d.ts +0 -15
  127. package/types/Rectangle.d.ts +0 -74
  128. package/types/Stack.d.ts +0 -15
  129. package/types/ajax.d.ts +0 -24
  130. package/types/arial.d.ts +0 -48
  131. package/types/astro/astro.d.ts +0 -38
  132. package/types/astro/earth.d.ts +0 -6
  133. package/types/astro/jd.d.ts +0 -254
  134. package/types/bv/Box.d.ts +0 -25
  135. package/types/bv/Sphere.d.ts +0 -38
  136. package/types/bv/index.d.ts +0 -3
  137. package/types/camera/Camera.d.ts +0 -303
  138. package/types/camera/Frustum.d.ts +0 -129
  139. package/types/camera/PlanetCamera.d.ts +0 -223
  140. package/types/camera/index.d.ts +0 -3
  141. package/types/cons.d.ts +0 -40
  142. package/types/control/CompassButton.d.ts +0 -18
  143. package/types/control/Control.d.ts +0 -101
  144. package/types/control/DebugInfo.d.ts +0 -16
  145. package/types/control/EarthCoordinates.d.ts +0 -47
  146. package/types/control/EarthNavigation.d.ts +0 -42
  147. package/types/control/GeoImageDragControl.d.ts +0 -6
  148. package/types/control/KeyboardNavigation.d.ts +0 -22
  149. package/types/control/LayerSwitcher.d.ts +0 -23
  150. package/types/control/Lighting.d.ts +0 -16
  151. package/types/control/MouseNavigation.d.ts +0 -51
  152. package/types/control/ScaleControl.d.ts +0 -22
  153. package/types/control/ShowFps.d.ts +0 -12
  154. package/types/control/SimpleNavigation.d.ts +0 -28
  155. package/types/control/Sun.d.ts +0 -52
  156. package/types/control/ToggleWireframe.d.ts +0 -12
  157. package/types/control/TouchNavigation.d.ts +0 -50
  158. package/types/control/ZoomControl.d.ts +0 -28
  159. package/types/control/index.d.ts +0 -17
  160. package/types/ellipsoid/Ellipsoid.d.ts +0 -142
  161. package/types/ellipsoid/index.d.ts +0 -3
  162. package/types/ellipsoid/wgs84.d.ts +0 -5
  163. package/types/entity/BaseBillboard.d.ts +0 -208
  164. package/types/entity/Billboard.d.ts +0 -94
  165. package/types/entity/BillboardHandler.d.ts +0 -74
  166. package/types/entity/Entity.d.ts +0 -331
  167. package/types/entity/EntityCollection.d.ts +0 -303
  168. package/types/entity/Geometry.d.ts +0 -73
  169. package/types/entity/GeometryHandler.d.ts +0 -76
  170. package/types/entity/Label.d.ts +0 -194
  171. package/types/entity/LabelHandler.d.ts +0 -24
  172. package/types/entity/PointCloud.d.ts +0 -174
  173. package/types/entity/PointCloudHandler.d.ts +0 -38
  174. package/types/entity/Polyline.d.ts +0 -304
  175. package/types/entity/PolylineHandler.d.ts +0 -18
  176. package/types/entity/Ray.d.ts +0 -123
  177. package/types/entity/RayHandler.d.ts +0 -67
  178. package/types/entity/ShapeHandler.d.ts +0 -22
  179. package/types/entity/Strip.d.ts +0 -118
  180. package/types/entity/StripHandler.d.ts +0 -38
  181. package/types/entity/index.d.ts +0 -8
  182. package/types/index.core.d.ts +0 -65
  183. package/types/index.d.ts +0 -45
  184. package/types/index.webgl.d.ts +0 -7
  185. package/types/inherits.d.ts +0 -4
  186. package/types/input/KeyboardHandler.d.ts +0 -10
  187. package/types/input/MouseHandler.d.ts +0 -5
  188. package/types/input/TouchHandler.d.ts +0 -5
  189. package/types/input/input.d.ts +0 -34
  190. package/types/layer/BaseGeoImage.d.ts +0 -107
  191. package/types/layer/CanvasTiles.d.ts +0 -75
  192. package/types/layer/GeoImage.d.ts +0 -65
  193. package/types/layer/GeoTexture2d.d.ts +0 -8
  194. package/types/layer/GeoVideo.d.ts +0 -80
  195. package/types/layer/KML.d.ts +0 -58
  196. package/types/layer/Layer.d.ts +0 -321
  197. package/types/layer/Material.d.ts +0 -48
  198. package/types/layer/Vector.d.ts +0 -228
  199. package/types/layer/WMS.d.ts +0 -66
  200. package/types/layer/XYZ.d.ts +0 -130
  201. package/types/layer/index.d.ts +0 -10
  202. package/types/light/LightSource.d.ts +0 -177
  203. package/types/math/Line2.d.ts +0 -11
  204. package/types/math/Line3.d.ts +0 -10
  205. package/types/math/Mat3.d.ts +0 -63
  206. package/types/math/Mat4.d.ts +0 -173
  207. package/types/math/Plane.d.ts +0 -17
  208. package/types/math/Quat.d.ts +0 -376
  209. package/types/math/Ray.d.ts +0 -81
  210. package/types/math/Vec2.d.ts +0 -308
  211. package/types/math/Vec3.d.ts +0 -459
  212. package/types/math/Vec4.d.ts +0 -161
  213. package/types/math/coder.d.ts +0 -42
  214. package/types/math/index.d.ts +0 -11
  215. package/types/math.d.ts +0 -261
  216. package/types/mercator.d.ts +0 -92
  217. package/types/proj/EPSG3857.d.ts +0 -5
  218. package/types/proj/EPSG4326.d.ts +0 -5
  219. package/types/proj/Proj.d.ts +0 -42
  220. package/types/quadTree/EntityCollectionNode.d.ts +0 -34
  221. package/types/quadTree/Node.d.ts +0 -61
  222. package/types/quadTree/quadTree.d.ts +0 -40
  223. package/types/renderer/Renderer.d.ts +0 -296
  224. package/types/renderer/RendererEvents.d.ts +0 -230
  225. package/types/res/images.d.ts +0 -3
  226. package/types/scene/Axes.d.ts +0 -11
  227. package/types/scene/BaseNode.d.ts +0 -60
  228. package/types/scene/Planet.d.ts +0 -574
  229. package/types/scene/RenderNode.d.ts +0 -143
  230. package/types/scene/SkyBox.d.ts +0 -10
  231. package/types/scene/index.d.ts +0 -4
  232. package/types/segment/Segment.d.ts +0 -271
  233. package/types/segment/SegmentLonLat.d.ts +0 -62
  234. package/types/segment/segmentHelper.d.ts +0 -13
  235. package/types/shaders/billboard.d.ts +0 -3
  236. package/types/shaders/depth.d.ts +0 -2
  237. package/types/shaders/drawnode.d.ts +0 -7
  238. package/types/shaders/label.d.ts +0 -4
  239. package/types/shaders/pointCloud.d.ts +0 -2
  240. package/types/shaders/polyline.d.ts +0 -3
  241. package/types/shaders/ray.d.ts +0 -2
  242. package/types/shaders/screenFrame.d.ts +0 -2
  243. package/types/shaders/shape.d.ts +0 -4
  244. package/types/shaders/skybox.d.ts +0 -2
  245. package/types/shaders/toneMapping.d.ts +0 -2
  246. package/types/shapes/BaseShape.d.ts +0 -247
  247. package/types/shapes/Sphere.d.ts +0 -41
  248. package/types/terrain/BilTerrain.d.ts +0 -8
  249. package/types/terrain/EmptyTerrain.d.ts +0 -72
  250. package/types/terrain/Geoid.d.ts +0 -26
  251. package/types/terrain/GlobusTerrain.d.ts +0 -153
  252. package/types/terrain/MapboxTerrain.d.ts +0 -8
  253. package/types/terrain/index.d.ts +0 -5
  254. package/types/utils/FontAtlas.d.ts +0 -14
  255. package/types/utils/GeoImageCreator.d.ts +0 -30
  256. package/types/utils/ImagesCacheManager.d.ts +0 -10
  257. package/types/utils/Loader.d.ts +0 -25
  258. package/types/utils/NormalMapCreator.d.ts +0 -39
  259. package/types/utils/PlainSegmentWorker.d.ts +0 -10
  260. package/types/utils/TerrainWorker.d.ts +0 -9
  261. package/types/utils/TextureAtlas.d.ts +0 -111
  262. package/types/utils/VectorTileCreator.d.ts +0 -16
  263. package/types/utils/colorTable.d.ts +0 -143
  264. package/types/utils/earcut.d.ts +0 -6
  265. package/types/utils/shared.d.ts +0 -230
  266. package/types/webgl/Framebuffer.d.ts +0 -135
  267. package/types/webgl/Handler.d.ts +0 -372
  268. package/types/webgl/Multisample.d.ts +0 -89
  269. package/types/webgl/Program.d.ts +0 -155
  270. package/types/webgl/ProgramController.d.ts +0 -84
  271. package/types/webgl/callbacks.d.ts +0 -1
  272. package/types/webgl/index.d.ts +0 -6
  273. package/types/webgl/types.d.ts +0 -2
@@ -2,24 +2,23 @@
2
2
  * @module og/bv/Sphere
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { Vec3 } from '../math/Vec3.js';
7
+ import { Vec3 } from "../math/Vec3.js";
8
8
 
9
9
  /**
10
10
  * Bounding sphere class.
11
11
  * @class
12
12
  * @param {Number} [radius] - Bounding sphere radius.
13
- * @param {og.Vec3} [center] - Bounding sphere coordiantes.
13
+ * @param {Vec3} [center] - Bounding sphere coordiantes.
14
14
  */
15
15
  class Sphere {
16
16
  /**
17
- *
18
- * @param {number} radius
19
- * @param {Vec3} center
17
+ *
18
+ * @param {number} radius
19
+ * @param {Vec3} center
20
20
  */
21
21
  constructor(radius, center) {
22
-
23
22
  /**
24
23
  * Sphere radius.
25
24
  * @public
@@ -30,7 +29,7 @@ class Sphere {
30
29
  /**
31
30
  * Sphere coordiantes.
32
31
  * @public
33
- * @type {og.Vec3}
32
+ * @type {Vec3}
34
33
  */
35
34
  this.center = center ? center.clone() : new Vec3();
36
35
  }
@@ -41,14 +40,18 @@ class Sphere {
41
40
  */
42
41
  setFromBounds(bounds) {
43
42
  let m = new Vec3(bounds[0], bounds[1], bounds[2]);
44
- this.center.set(m.x + (bounds[3] - m.x) * 0.5, m.y + (bounds[3] - m.y) * 0.5, m.z + (bounds[5] - m.z) * 0.5);
43
+ this.center.set(
44
+ m.x + (bounds[3] - m.x) * 0.5,
45
+ m.y + (bounds[3] - m.y) * 0.5,
46
+ m.z + (bounds[5] - m.z) * 0.5
47
+ );
45
48
  this.radius = this.center.distance(m);
46
49
  }
47
50
 
48
51
  /**
49
52
  * Sets bounding sphere coordiantes by ellipsoid geodetic extend.
50
- * @param {og.Ellipsoid} ellipsoid - Ellipsoid.
51
- * @param {og.Extent} extent - Geodetic extent.
53
+ * @param {Ellipsoid} ellipsoid - Ellipsoid.
54
+ * @param {Extent} extent - Geodetic extent.
52
55
  */
53
56
  setFromExtent(ellipsoid, extent) {
54
57
  this.setFromBounds(extent.getCartesianBounds(ellipsoid));
@@ -12,52 +12,56 @@ import { Mat4 } from "../math/Mat4.js";
12
12
  /**
13
13
  * Camera class.
14
14
  * @class
15
- * @param {og.Renderer} [renderer] - Renderer uses the camera instance.
15
+ * @param {Renderer} [renderer] - Renderer uses the camera instance.
16
16
  * @param {Object} [options] - Camera options:
17
17
  * @param {Object} [options.name] - Camera name.
18
18
  * @param {number} [options.viewAngle=38] - Camera angle of view. Default is 30.0
19
19
  * @param {number} [options.near=1] - Camera near plane distance. Default is 1.0
20
20
  * @param {number} [options.far=og.math.MAX] - Camera far plane distance. Deafult is og.math.MAX
21
- * @param {og.Vec3} [options.eye=[0,0,0]] - Camera eye position. Default (0,0,0)
22
- * @param {og.Vec3} [options.look=[0,0,0]] - Camera look position. Default (0,0,0)
23
- * @param {og.Vec3} [options.up=[0,1,0]] - Camera eye position. Default (0,1,0)
21
+ * @param {Vec3} [options.eye=[0,0,0]] - Camera eye position. Default (0,0,0)
22
+ * @param {Vec3} [options.look=[0,0,0]] - Camera look position. Default (0,0,0)
23
+ * @param {Vec3} [options.up=[0,1,0]] - Camera eye position. Default (0,1,0)
24
24
  *
25
25
  * @fires og.Camera#viewchange
26
26
  */
27
27
  class Camera {
28
+ /**
29
+ * @param {Renderer} [renderer] - Renderer uses the camera instance.
30
+ * @param {Object} [options] - Camera options:
31
+ */
28
32
  constructor(renderer, options) {
29
33
  /**
30
34
  * Assigned renderer
31
35
  * @public
32
- * @type {og.Renderer}
36
+ * @type {Renderer}
33
37
  */
34
38
  this.renderer = renderer;
35
39
 
36
40
  /**
37
41
  * Camera events handler
38
42
  * @public
39
- * @type {og.Events}
43
+ * @type {Events}
40
44
  */
41
45
  this.events = new Events(EVENT_NAMES, this);
42
46
 
43
47
  /**
44
48
  * Camera position.
45
49
  * @public
46
- * @type {og.Vec3}
50
+ * @type {Vec3}
47
51
  */
48
52
  this.eye = new Vec3();
49
53
 
50
54
  /**
51
55
  * Camera RTE high position
52
56
  * @public
53
- * @type {og.Vec3}
57
+ * @type {Vec3}
54
58
  */
55
59
  this.eyeHigh = new Float32Array(3);
56
60
 
57
61
  /**
58
62
  * Camera RTE low position
59
63
  * @public
60
- * @type {og.Vec3}
64
+ * @type {Vec3}
61
65
  */
62
66
  this.eyeLow = new Float32Array(3);
63
67
 
@@ -78,35 +82,35 @@ class Camera {
78
82
  /**
79
83
  * Camera normal matrix.
80
84
  * @protected
81
- * @type {og.Mat3}
85
+ * @type {Mat3}
82
86
  */
83
87
  this._normalMatrix = new Mat3();
84
88
 
85
89
  /**
86
90
  * Camera view matrix.
87
91
  * @protected
88
- * @type {og.Mat4}
92
+ * @type {Mat4}
89
93
  */
90
94
  this._viewMatrix = new Mat4();
91
95
 
92
96
  /**
93
97
  * Camera right vector.
94
98
  * @protected
95
- * @type {og.Vec3}
99
+ * @type {Vec3}
96
100
  */
97
101
  this._u = new Vec3(0.0, 1.0, 0.0); // up x n
98
102
 
99
103
  /**
100
104
  * Camera up vector.
101
105
  * @protected
102
- * @type {og.Vec3}
106
+ * @type {Vec3}
103
107
  */
104
108
  this._v = new Vec3(1.0, 0.0, 0.0); // n x u - UP
105
109
 
106
110
  /**
107
111
  * Camera forward vector.
108
112
  * @protected
109
- * @type {og.Vec3}
113
+ * @type {Vec3}
110
114
  */
111
115
  this._n = new Vec3(0.0, 0.0, 1.0); // eye - look - FORWARD
112
116
 
@@ -115,7 +119,7 @@ class Camera {
115
119
  this._pv = this._v.clone();
116
120
  this._pn = this._n.clone();
117
121
  this._peye = this.eye.clone();
118
- this._moved = false;
122
+ this.isMoved = false;
119
123
 
120
124
  this._tanViewAngle_hrad = 0.0;
121
125
  this._tanViewAngle_hradOneByHeight = 0.0;
@@ -174,20 +178,13 @@ class Camera {
174
178
  n = this._n,
175
179
  eye = this.eye;
176
180
 
177
- if (this.events.moveend.handlers.length) {
178
- if (
179
- this._peye.equal(eye) &&
180
- this._pu.equal(u) &&
181
- this._pv.equal(v) &&
182
- this._pn.equal(n)
183
- ) {
184
- if (this._moved) {
185
- this.events.dispatch(this.events.moveend, this);
186
- }
187
- this._moved = false;
188
- } else {
189
- this._moved = true;
181
+ if (this._peye.equal(eye) && this._pu.equal(u) && this._pv.equal(v) && this._pn.equal(n)) {
182
+ if (this.isMoved) {
183
+ this.events.dispatch(this.events.moveend, this);
190
184
  }
185
+ this.isMoved = false;
186
+ } else {
187
+ this.isMoved = true;
191
188
  }
192
189
 
193
190
  this._pu.copy(u);
@@ -199,14 +196,14 @@ class Camera {
199
196
  /**
200
197
  * Camera initialization.
201
198
  * @public
202
- * @param {og.Renderer} renderer - OpenGlobus renderer object.
199
+ * @param {Renderer} renderer - OpenGlobus renderer object.
203
200
  * @param {Object} [options] - Camera options:
204
201
  * @param {number} [options.viewAngle] - Camera angle of view. Default is 30.0
205
202
  * @param {number} [options.near] - Camera near plane distance. Default is 1.0
206
203
  * @param {number} [options.far] - Camera far plane distance. Deafult is og.math.MAX
207
- * @param {og.Vec3} [options.eye] - Camera eye position. Default (0,0,0)
208
- * @param {og.Vec3} [options.look] - Camera look position. Default (0,0,0)
209
- * @param {og.Vec3} [options.up] - Camera eye position. Default (0,1,0)
204
+ * @param {Vec3} [options.eye] - Camera eye position. Default (0,0,0)
205
+ * @param {Vec3} [options.look] - Camera look position. Default (0,0,0)
206
+ * @param {Vec3} [options.up] - Camera eye position. Default (0,1,0)
210
207
  */
211
208
  _init(options) {
212
209
  this._setProj(this._viewAngle, this._aspect);
@@ -362,10 +359,10 @@ class Camera {
362
359
  /**
363
360
  * Sets camera to eye position
364
361
  * @public
365
- * @param {og.Vec3} eye - Camera position
366
- * @param {og.Vec3} look - Look point
367
- * @param {og.Vec3} up - Camera up vector
368
- * @returns {og.Camera} - This camera
362
+ * @param {Vec3} eye - Camera position
363
+ * @param {Vec3} look - Look point
364
+ * @param {Vec3} up - Camera up vector
365
+ * @returns {Camera} - This camera
369
366
  */
370
367
  set(eye, look, up) {
371
368
  this.eye.x = eye.x;
@@ -386,8 +383,8 @@ class Camera {
386
383
  /**
387
384
  * Sets camera look point
388
385
  * @public
389
- * @param {og.Vec3} look - Look point
390
- * @param {og.Vec3} [up] - Camera up vector otherwise camera current up vector(this._v)
386
+ * @param {Vec3} look - Look point
387
+ * @param {Vec3} [up] - Camera up vector otherwise camera current up vector(this._v)
391
388
  */
392
389
  look(look, up) {
393
390
  this._n.set(this.eye.x - look.x, this.eye.y - look.y, this.eye.z - look.z);
@@ -478,7 +475,7 @@ class Camera {
478
475
  * @public
479
476
  * @param {number} x - Scren X coordinate
480
477
  * @param {number} y - Scren Y coordinate
481
- * @returns {og.Vec3} - Direction vector
478
+ * @returns {Vec3} - Direction vector
482
479
  */
483
480
  unproject(x, y) {
484
481
  var c = this.renderer.handler.canvas,
@@ -501,8 +498,8 @@ class Camera {
501
498
  /**
502
499
  * Gets projected 3d point to the 2d screen coordiantes
503
500
  * @public
504
- * @param {og.Vec3} v - Cartesian 3d coordiantes
505
- * @returns {og.Vec2} - Screen point coordinates
501
+ * @param {Vec3} v - Cartesian 3d coordiantes
502
+ * @returns {Vec2} - Screen point coordinates
506
503
  */
507
504
  project(v) {
508
505
  var r = this.frustums[0]._projectionViewMatrix.mulVec4(v.toVec4()),
@@ -516,8 +513,8 @@ class Camera {
516
513
  * @param {number} angle - Rotation angle in radians
517
514
  * @param {boolean} isArc - If true camera up vector gets from current up vector every frame,
518
515
  * otherwise up is always input parameter.
519
- * @param {og.Vec3} center - Point that the camera rotates around
520
- * @param {og.math.Vecto3} [up] - Camera up vector
516
+ * @param {Vec3} center - Point that the camera rotates around
517
+ * @param {Vecto3} [up] - Camera up vector
521
518
  */
522
519
  rotateAround(angle, isArc, center, up) {
523
520
  center = center || Vec3.ZERO;
@@ -541,8 +538,8 @@ class Camera {
541
538
  * @param {number} angle - Rotation angle in radians.
542
539
  * @param {boolaen} isArc - If true camera up vector gets from current up vector every frame,
543
540
  * otherwise up is always input parameter.
544
- * @param {og.Vec3} center - Point that the camera rotates around.
545
- * @param {og.Vec3} [up] - Camera up vector.
541
+ * @param {Vec3} center - Point that the camera rotates around.
542
+ * @param {Vec3} [up] - Camera up vector.
546
543
  */
547
544
  rotateHorizontal(angle, isArc, center, up) {
548
545
  this.rotateAround(angle, isArc, center, up);
@@ -551,7 +548,7 @@ class Camera {
551
548
  /**
552
549
  * Rotates camera around center point by vecrtical.
553
550
  * @param {number} angle - Rotation angle in radians.
554
- * @param {og.Vec3} center - Point that the camera rotates around.
551
+ * @param {Vec3} center - Point that the camera rotates around.
555
552
  */
556
553
  rotateVertical(angle, center) {
557
554
  this.rotateAround(angle, false, center, this._u);
@@ -560,8 +557,8 @@ class Camera {
560
557
  /**
561
558
  * Gets 3d size factor. Uses in LOD distance calculation.
562
559
  * @public
563
- * @param {og.Vec3} p - Far point.
564
- * @param {og.Vec3} r - Far point.
560
+ * @param {Vec3} p - Far point.
561
+ * @param {Vec3} r - Far point.
565
562
  * @returns {number} - Size factor.
566
563
  */
567
564
  projectedSize(p, r) {
@@ -571,7 +568,7 @@ class Camera {
571
568
  /**
572
569
  * Returns normal matrix.
573
570
  * @public
574
- * @returns {og.Mat3} - Normal matrix.
571
+ * @returns {Mat3} - Normal matrix.
575
572
  */
576
573
  getNormalMatrix() {
577
574
  return this._normalMatrix._m;
@@ -580,7 +577,7 @@ class Camera {
580
577
  /**
581
578
  * Returns model matrix.
582
579
  * @public
583
- * @returns {og.Mat4} - View matrix.
580
+ * @returns {Mat4} - View matrix.
584
581
  */
585
582
  getViewMatrix() {
586
583
  return this._viewMatrix._m;
@@ -601,7 +598,7 @@ class Camera {
601
598
  /**
602
599
  * Returns projection matrix.
603
600
  * @public
604
- * @returns {og.Mat4} - Projection matrix.
601
+ * @returns {Mat4} - Projection matrix.
605
602
  */
606
603
  getProjectionMatrix() {
607
604
  return this.frustum._projectionMatrix._m;
@@ -610,7 +607,7 @@ class Camera {
610
607
  /**
611
608
  * Returns projection and model matrix product.
612
609
  * @public
613
- * @return {og.Mat4} - Projection-view matrix.
610
+ * @return {Mat4} - Projection-view matrix.
614
611
  */
615
612
  getProjectionViewMatrix() {
616
613
  return this.frustum._projectionViewMatrix._m;
@@ -619,7 +616,7 @@ class Camera {
619
616
  /**
620
617
  * Returns inverse projection and model matrix product.
621
618
  * @public
622
- * @returns {og.Mat4} - Inversed projection-view matrix.
619
+ * @returns {Mat4} - Inversed projection-view matrix.
623
620
  */
624
621
  getInverseProjectionViewMatrix() {
625
622
  return this.frustum._inverseProjectionViewMatrix._m;
@@ -628,7 +625,7 @@ class Camera {
628
625
  /**
629
626
  * Returns inverse projection matrix.
630
627
  * @public
631
- * @returns {og.Mat4} - Inversed projection-view matrix.
628
+ * @returns {Mat4} - Inversed projection-view matrix.
632
629
  */
633
630
  getInverseProjectionMatrix() {
634
631
  return this.frustum._inverseProjectionMatrix._m;
@@ -1,6 +1,6 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- import { Mat4 } from '../math/Mat4.js';
3
+ import { Mat4 } from "../math/Mat4.js";
4
4
 
5
5
  function planeNormalize(plane) {
6
6
  var t = 1.0 / Math.sqrt(plane[0] * plane[0] + plane[1] * plane[1] + plane[2] * plane[2]);
@@ -15,6 +15,9 @@ function planeNormalize(plane) {
15
15
  * @class
16
16
  */
17
17
  class Frustum {
18
+ /**
19
+ * @param {*} options
20
+ */
18
21
  constructor(options = {}) {
19
22
  /**
20
23
  * Frustum planes.
@@ -29,28 +32,28 @@ class Frustum {
29
32
  /**
30
33
  * Camera projection matrix.
31
34
  * @protected
32
- * @type {og.Mat4}
35
+ * @type {Mat4}
33
36
  */
34
37
  this._projectionMatrix = new Mat4();
35
38
 
36
39
  /**
37
40
  * Camera inverse projection matrix.
38
41
  * @protected
39
- * @type {og.Mat4}
42
+ * @type {Mat4}
40
43
  */
41
44
  this._inverseProjectionMatrix = new Mat4();
42
45
 
43
46
  /**
44
47
  * Product of projection and view matrices.
45
48
  * @protected
46
- * @type {og.Mat4}
49
+ * @type {Mat4}
47
50
  */
48
51
  this._projectionViewMatrix = new Mat4();
49
52
 
50
53
  /**
51
54
  * Inverse projectionView Matrix.
52
55
  * @protected
53
- * @type {og.Mat4}
56
+ * @type {Mat4}
54
57
  */
55
58
  this._inverseProjectionViewMatrix = new Mat4();
56
59
 
@@ -85,7 +88,8 @@ class Frustum {
85
88
  */
86
89
  this.far = 0.0;
87
90
 
88
- this._cameraFrustumIndex = options.cameraFrustumIndex != undefined ? options.cameraFrustumIndex : -1;
91
+ this._cameraFrustumIndex =
92
+ options.cameraFrustumIndex != undefined ? options.cameraFrustumIndex : -1;
89
93
 
90
94
  this.setProjectionMatrix(
91
95
  options.fov || 30.0,
@@ -140,15 +144,21 @@ class Frustum {
140
144
  * @param {number} far - Far camera distance.
141
145
  */
142
146
  setProjectionMatrix(angle, aspect, near, far) {
143
-
144
- this.top = near * Math.tan(angle * Math.PI / 360);
147
+ this.top = near * Math.tan((angle * Math.PI) / 360);
145
148
  this.bottom = -this.top;
146
149
  this.right = this.top * aspect;
147
150
  this.left = -this.right;
148
151
  this.near = near;
149
152
  this.far = far;
150
153
 
151
- this._projectionMatrix.setPerspective(this.left, this.right, this.bottom, this.top, near, far);
154
+ this._projectionMatrix.setPerspective(
155
+ this.left,
156
+ this.right,
157
+ this.bottom,
158
+ this.top,
159
+ near,
160
+ far
161
+ );
152
162
  this._projectionMatrix.inverseTo(this._inverseProjectionMatrix);
153
163
  }
154
164
 
@@ -158,7 +168,6 @@ class Frustum {
158
168
  * @param {Mat4} projectionView - projectionView matrix.
159
169
  */
160
170
  setViewMatrix(viewMatrix) {
161
-
162
171
  this._projectionViewMatrix = this._projectionMatrix.mul(viewMatrix);
163
172
  this._projectionViewMatrix.inverseTo(this._inverseProjectionViewMatrix);
164
173
 
@@ -210,7 +219,7 @@ class Frustum {
210
219
  /**
211
220
  * Returns true if a point in the frustum.
212
221
  * @public
213
- * @param {og.Vec3} point - Cartesian point.
222
+ * @param {Vec3} point - Cartesian point.
214
223
  * @returns {boolean} -
215
224
  */
216
225
  containsPoint(point) {
@@ -227,7 +236,7 @@ class Frustum {
227
236
  /**
228
237
  * Returns true if the frustum contains a bonding sphere, but bottom plane exclude.
229
238
  * @public
230
- * @param {og.bv.Sphere} sphere - Bounding sphere.
239
+ * @param {Sphere} sphere - Bounding sphere.
231
240
  * @returns {boolean} -
232
241
  */
233
242
  containsSphereBottomExc(sphere) {
@@ -251,7 +260,7 @@ class Frustum {
251
260
  /**
252
261
  * Returns true if the frustum contains a bonding sphere.
253
262
  * @public
254
- * @param {og.bv.Sphere} sphere - Bounding sphere.
263
+ * @param {Sphere} sphere - Bounding sphere.
255
264
  * @returns {boolean} -
256
265
  */
257
266
  containsSphere(sphere) {
@@ -287,15 +296,17 @@ class Frustum {
287
296
  /**
288
297
  * Returns true if the frustum contains a bounding box.
289
298
  * @public
290
- * @param {og.bv.Box} box - Bounding box.
299
+ * @param {Box} box - Bounding box.
291
300
  * @returns {boolean} -
292
301
  */
293
302
  containsBox(box) {
294
- var result = true, cout, cin;
303
+ var result = true,
304
+ cout,
305
+ cin;
295
306
 
296
307
  for (var i = 0; i < 6; i++) {
297
-
298
- cout = 0; cin = 0;
308
+ cout = 0;
309
+ cin = 0;
299
310
 
300
311
  for (var k = 0; k < 8 && (cin === 0 || cout === 0); k++) {
301
312
  var d = box.vertices[k].dotArr(this._f[i]) + this._f[i][3];
@@ -17,8 +17,8 @@ import { Mat4 } from "../math/Mat4.js";
17
17
  /**
18
18
  * Planet camera.
19
19
  * @class
20
- * @extends {og.Camera}
21
- * @param {og.RenderNode} planet - Planet render node.
20
+ * @extends {Camera}
21
+ * @param {RenderNode} planet - Planet render node.
22
22
  * @param {Object} [options] - Planet camera options:
23
23
  * @param {Object} [options.name] - Camera name.
24
24
  * @param {number} [options.viewAngle=37] - Camera angle of view. Default is 35.0
@@ -26,18 +26,22 @@ import { Mat4 } from "../math/Mat4.js";
26
26
  * @param {number} [options.far] - Camera far plane distance. Deafult is og.math.MAX
27
27
  * @param {number} [options.minAltitude] - Minimal altitude for the camera. Deafult is 1
28
28
  * @param {number} [options.maxAltitude] - Maximal altitude for the camera. Deafult is 20000000
29
- * @param {og.Vec3} [options.eye] - Camera eye position. Default (0,0,0)
30
- * @param {og.Vec3} [options.look] - Camera look position. Default (0,0,0)
31
- * @param {og.Vec3} [options.up] - Camera eye position. Default (0,1,0)
29
+ * @param {Vec3} [options.eye] - Camera eye position. Default (0,0,0)
30
+ * @param {Vec3} [options.look] - Camera look position. Default (0,0,0)
31
+ * @param {Vec3} [options.up] - Camera eye position. Default (0,1,0)
32
32
  */
33
33
  class PlanetCamera extends Camera {
34
+ /**
35
+ * @param {RenderNode} planet - Planet render node.
36
+ * @param {Object} [options] - Planet camera options:
37
+ */
34
38
  constructor(planet, options) {
35
39
  super(
36
40
  planet.renderer,
37
41
  Object.assign(
38
42
  {},
39
43
  {
40
- frustums: /*[[100, 10000000]]*/ [
44
+ frustums: /*[[100, 10000000]]*/[
41
45
  [1, 100 + 0.075],
42
46
  [100, 1000 + 0.075],
43
47
  [1000, 1e6 + 10000],
@@ -50,7 +54,7 @@ class PlanetCamera extends Camera {
50
54
  /**
51
55
  * Assigned camera's planet.
52
56
  * @public
53
- * @type {og.scene.Planet}
57
+ * @type {Planet}
54
58
  */
55
59
  this.planet = planet;
56
60
 
@@ -92,14 +96,14 @@ class PlanetCamera extends Camera {
92
96
  /**
93
97
  * Cartesian coordinates on the terrain.
94
98
  * @protected
95
- * @type {og.Vec3}
99
+ * @type {Vec3}
96
100
  */
97
101
  this._terrainPoint = new Vec3();
98
102
 
99
103
  /**
100
104
  * Quad node that camera flies over.
101
105
  * @protected
102
- * @type {og.quadTree.Node}
106
+ * @type {quadTree.Node}
103
107
  */
104
108
  this._insideSegment = null;
105
109
 
@@ -178,7 +182,7 @@ class PlanetCamera extends Camera {
178
182
  * @public
179
183
  * @param {LonLat} lonlat - New camera and camera view position.
180
184
  * @param {LonLat} [lookLonLat] - Look up coordinates.
181
- * @param {og.Vec3} [up] - Camera UP vector. Default (0,1,0)
185
+ * @param {Vec3} [up] - Camera UP vector. Default (0,1,0)
182
186
  */
183
187
  setLonLat(lonlat, lookLonLat, up) {
184
188
  this.stopFlying();
@@ -211,9 +215,9 @@ class PlanetCamera extends Camera {
211
215
  /**
212
216
  * Gets position by viewable extent.
213
217
  * @public
214
- * @param {og.Extent} extent - Viewable extent.
218
+ * @param {Extent} extent - Viewable extent.
215
219
  * @param {Number} height - Camera height
216
- * @returns {og.Vec3}
220
+ * @returns {Vec3}
217
221
  */
218
222
  getExtentPosition(extent, height) {
219
223
  var north = extent.getNorth();
@@ -281,7 +285,7 @@ class PlanetCamera extends Camera {
281
285
  /**
282
286
  * View current extent.
283
287
  * @public
284
- * @param {og.Extent} extent - Current extent.
288
+ * @param {Extent} extent - Current extent.
285
289
  */
286
290
  viewExtent(extent, height) {
287
291
  this.stopFlying();
@@ -292,8 +296,8 @@ class PlanetCamera extends Camera {
292
296
  /**
293
297
  * Flies to the current extent.
294
298
  * @public
295
- * @param {og.Extent} extent - Current extent.
296
- * @param {og.Vec3} [up] - Camera UP in the end of flying. Default - (0,1,0)
299
+ * @param {Extent} extent - Current extent.
300
+ * @param {Vec3} [up] - Camera UP in the end of flying. Default - (0,1,0)
297
301
  * @param {Number} [ampl] - Altitude amplitude factor.
298
302
  * @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
299
303
  * @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
@@ -356,9 +360,9 @@ class PlanetCamera extends Camera {
356
360
  /**
357
361
  * Flies to the cartesian coordinates.
358
362
  * @public
359
- * @param {og.Vec3} cartesian - Finish cartesian coordinates.
360
- * @param {og.Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
361
- * @param {og.Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
363
+ * @param {Vec3} cartesian - Finish cartesian coordinates.
364
+ * @param {Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
365
+ * @param {Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
362
366
  * @param {Number} [ampl=1.0] - Altitude amplitude factor.
363
367
  * @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
364
368
  * @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
@@ -453,8 +457,8 @@ class PlanetCamera extends Camera {
453
457
  * Flies to the geo coordiantes.
454
458
  * @public
455
459
  * @param {LonLat} lonlat - Finish coordinates.
456
- * @param {og.Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
457
- * @param {og.Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
460
+ * @param {Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
461
+ * @param {Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
458
462
  * @param {Number} [ampl] - Altitude amplitude factor.
459
463
  * @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
460
464
  * @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
@@ -632,15 +636,20 @@ class PlanetCamera extends Camera {
632
636
  getHeading() {
633
637
  let u = this.eye.normal();
634
638
  let f = Vec3.proj_b_to_plane(
635
- this.slope >= 0.97 ? this.getUp() : this.getForward(),
636
- u
637
- ).normalize(),
639
+ this.slope >= 0.97 ? this.getUp() : this.getForward(),
640
+ u
641
+ ).normalize(),
638
642
  n = Vec3.proj_b_to_plane(Vec3.UP, u).normalize();
639
643
  let res = Math.sign(u.dot(f.cross(n))) * Math.acos(f.dot(n)) * math.DEGREES;
640
644
  if (res < 0.0) {
641
645
  return 360.0 + res;
642
646
  }
643
647
  return res;
648
+ }
649
+
650
+ isVisible(poi) {
651
+ let e = this.eye.length();
652
+ return this.eye.distance(poi) < Math.sqrt(e * e - this.planet.ellipsoid._a2);
644
653
  }
645
654
  }
646
655
 
@@ -82,10 +82,14 @@ let svg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
82
82
  /**
83
83
  * Planet compass button
84
84
  * @class
85
- * @extends {og.control.Control}
85
+ * @extends {Control}
86
86
  * @params {Object} [options] - Control options.
87
87
  */
88
88
  class CompassButton extends Control {
89
+ /**
90
+ *
91
+ * @params {Object} [options] - Control options.
92
+ */
89
93
  constructor(options) {
90
94
  super(options);
91
95