@openglobus/og 0.11.1 → 0.11.6

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 (255) hide show
  1. package/package.json +18 -20
  2. package/src/og/Clock.js +11 -11
  3. package/src/og/Deferred.js +1 -1
  4. package/src/og/Events.js +9 -7
  5. package/src/og/Extent.js +117 -72
  6. package/src/og/Globe.js +35 -22
  7. package/src/og/ImageCanvas.js +24 -18
  8. package/src/og/Lock.js +2 -2
  9. package/src/og/LonLat.js +40 -37
  10. package/src/og/Popup.js +21 -15
  11. package/src/og/QueueArray.js +7 -3
  12. package/src/og/Rectangle.js +11 -6
  13. package/src/og/Stack.js +8 -5
  14. package/src/og/ajax.js +21 -33
  15. package/src/og/astro/astro.js +5 -5
  16. package/src/og/astro/earth.js +23 -17
  17. package/src/og/astro/jd.js +44 -39
  18. package/src/og/astro/orbit.js +20 -18
  19. package/src/og/astro/rotation.js +17 -8
  20. package/src/og/bv/Box.js +7 -3
  21. package/src/og/bv/Sphere.js +17 -9
  22. package/src/og/camera/Camera.js +137 -86
  23. package/src/og/camera/Frustum.js +30 -19
  24. package/src/og/camera/PlanetCamera.js +30 -26
  25. package/src/og/control/CompassButton.js +8 -2
  26. package/src/og/control/Control.js +13 -11
  27. package/src/og/control/DebugInfo.js +4 -1
  28. package/src/og/control/EarthCoordinates.js +62 -41
  29. package/src/og/control/EarthNavigation.js +20 -22
  30. package/src/og/control/GeoImageDragControl.js +1 -1
  31. package/src/og/control/KeyboardNavigation.js +12 -12
  32. package/src/og/control/LayerSwitcher.js +24 -23
  33. package/src/og/control/Lighting.js +1 -1
  34. package/src/og/control/MouseNavigation.js +1 -1
  35. package/src/og/control/ScaleControl.js +1 -1
  36. package/src/og/control/SegmentBoundVisualization.js +8 -9
  37. package/src/og/control/ShowFps.js +15 -10
  38. package/src/og/control/SimpleNavigation.js +8 -10
  39. package/src/og/control/Sun.js +25 -15
  40. package/src/og/control/ToggleWireframe.js +5 -5
  41. package/src/og/control/TouchNavigation.js +58 -45
  42. package/src/og/control/ZoomControl.js +41 -25
  43. package/src/og/control/index.js +4 -0
  44. package/src/og/ellipsoid/Ellipsoid.js +181 -85
  45. package/src/og/ellipsoid/wgs84.js +4 -4
  46. package/src/og/entity/BaseBillboard.js +97 -44
  47. package/src/og/entity/Billboard.js +15 -11
  48. package/src/og/entity/BillboardHandler.js +314 -64
  49. package/src/og/entity/Entity.js +106 -74
  50. package/src/og/entity/EntityCollection.js +72 -49
  51. package/src/og/entity/GeoObject.js +228 -0
  52. package/src/og/entity/GeoObjectHandler.js +910 -0
  53. package/src/og/entity/Geometry.js +29 -26
  54. package/src/og/entity/GeometryHandler.js +598 -126
  55. package/src/og/entity/Label.js +74 -40
  56. package/src/og/entity/LabelHandler.js +47 -246
  57. package/src/og/entity/LabelWorker.js +213 -0
  58. package/src/og/entity/Object3d.js +504 -0
  59. package/src/og/entity/PointCloud.js +81 -33
  60. package/src/og/entity/PointCloudHandler.js +9 -9
  61. package/src/og/entity/Polyline.js +39 -39
  62. package/src/og/entity/Ray.js +61 -28
  63. package/src/og/entity/ShapeHandler.js +1 -1
  64. package/src/og/entity/Strip.js +77 -48
  65. package/src/og/entity/StripHandler.js +27 -27
  66. package/src/og/entity/index.js +8 -16
  67. package/src/og/input/KeyboardHandler.js +107 -104
  68. package/src/og/input/MouseHandler.js +81 -78
  69. package/src/og/input/TouchHandler.js +55 -51
  70. package/src/og/layer/BaseGeoImage.js +61 -30
  71. package/src/og/layer/CanvasTiles.js +26 -24
  72. package/src/og/layer/GeoImage.js +10 -10
  73. package/src/og/layer/GeoTexture2d.js +1 -1
  74. package/src/og/layer/GeoVideo.js +3 -3
  75. package/src/og/layer/KML.js +66 -40
  76. package/src/og/layer/Layer.js +27 -17
  77. package/src/og/layer/Material.js +93 -61
  78. package/src/og/layer/Vector.js +118 -72
  79. package/src/og/layer/WMS.js +36 -19
  80. package/src/og/layer/XYZ.js +55 -48
  81. package/src/og/light/LightSource.js +47 -40
  82. package/src/og/math/Line2.js +24 -24
  83. package/src/og/math/Line3.js +103 -102
  84. package/src/og/math/Mat3.js +134 -121
  85. package/src/og/math/Mat4.js +603 -459
  86. package/src/og/math/Plane.js +21 -20
  87. package/src/og/math/Quat.js +980 -927
  88. package/src/og/math/Ray.js +195 -187
  89. package/src/og/math/Vec2.js +127 -117
  90. package/src/og/math/Vec3.js +206 -176
  91. package/src/og/math/Vec4.js +49 -53
  92. package/src/og/math/coder.js +18 -18
  93. package/src/og/math.js +12 -12
  94. package/src/og/mercator.js +11 -11
  95. package/src/og/proj/EPSG3857.js +4 -4
  96. package/src/og/proj/EPSG4326.js +4 -4
  97. package/src/og/proj/Proj.js +31 -31
  98. package/src/og/quadTree/EntityCollectionNode.js +310 -300
  99. package/src/og/quadTree/Node.js +1008 -993
  100. package/src/og/renderer/Renderer.js +768 -747
  101. package/src/og/renderer/RendererEvents.js +9 -6
  102. package/src/og/scene/Axes.js +1 -1
  103. package/src/og/scene/BaseNode.js +8 -9
  104. package/src/og/scene/Planet.js +115 -87
  105. package/src/og/scene/RenderNode.js +29 -22
  106. package/src/og/scene/SkyBox.js +1 -1
  107. package/src/og/segment/Segment.js +1886 -1878
  108. package/src/og/segment/SegmentLonLat.js +298 -268
  109. package/src/og/segment/segmentHelper.js +11 -11
  110. package/src/og/shaders/bloom.js +1 -1
  111. package/src/og/shaders/blur.js +2 -2
  112. package/src/og/shaders/depth.js +1 -1
  113. package/src/og/shaders/geoObject.js +211 -0
  114. package/src/og/shaders/label.js +1 -1
  115. package/src/og/shaders/lumFilter.js +1 -1
  116. package/src/og/shaders/pointCloud.js +42 -42
  117. package/src/og/shaders/screenFrame.js +1 -1
  118. package/src/og/shaders/shape.js +15 -21
  119. package/src/og/shaders/skybox.js +37 -37
  120. package/src/og/shaders/toneMapping.js +1 -1
  121. package/src/og/shapes/BaseShape.js +129 -57
  122. package/src/og/shapes/Icosphere.js +30 -15
  123. package/src/og/shapes/Sphere.js +13 -16
  124. package/src/og/terrain/BilTerrain.js +2 -1
  125. package/src/og/terrain/EmptyTerrain.js +2 -2
  126. package/src/og/terrain/Geoid.js +2 -2
  127. package/src/og/terrain/GlobusTerrain.js +10 -10
  128. package/src/og/terrain/MapboxTerrain.js +1 -1
  129. package/src/og/utils/GeoImageCreator.js +9 -9
  130. package/src/og/utils/Loader.js +6 -6
  131. package/src/og/utils/NormalMapCreator.js +13 -13
  132. package/src/og/utils/TerrainWorker.js +1 -1
  133. package/src/og/utils/TextureAtlas.js +20 -22
  134. package/src/og/utils/VectorTileCreator.js +5 -5
  135. package/src/og/utils/earcut.js +1 -1
  136. package/src/og/utils/shared.js +15 -15
  137. package/src/og/webgl/Framebuffer.js +101 -53
  138. package/src/og/webgl/Handler.js +125 -85
  139. package/src/og/webgl/Multisample.js +55 -27
  140. package/src/og/webgl/Program.js +80 -35
  141. package/src/og/webgl/ProgramController.js +27 -23
  142. package/src/og/webgl/callbacks.js +8 -8
  143. package/types/Clock.d.ts +6 -2
  144. package/types/Deferred.d.ts +1 -1
  145. package/types/Events.d.ts +8 -4
  146. package/types/Extent.d.ts +37 -33
  147. package/types/Globe.d.ts +15 -13
  148. package/types/ImageCanvas.d.ts +5 -3
  149. package/types/LonLat.d.ts +24 -24
  150. package/types/Popup.d.ts +4 -0
  151. package/types/QueueArray.d.ts +6 -2
  152. package/types/Rectangle.d.ts +10 -4
  153. package/types/Stack.d.ts +4 -0
  154. package/types/ajax.d.ts +1 -1
  155. package/types/astro/earth.d.ts +3 -2
  156. package/types/bv/Box.d.ts +10 -5
  157. package/types/bv/Sphere.d.ts +13 -7
  158. package/types/camera/Camera.d.ts +90 -81
  159. package/types/camera/Frustum.d.ts +26 -22
  160. package/types/camera/PlanetCamera.d.ts +49 -53
  161. package/types/control/CompassButton.d.ts +4 -4
  162. package/types/control/Control.d.ts +7 -4
  163. package/types/control/DebugInfo.d.ts +3 -4
  164. package/types/control/EarthCoordinates.d.ts +6 -6
  165. package/types/control/EarthNavigation.d.ts +42 -0
  166. package/types/control/KeyboardNavigation.d.ts +3 -4
  167. package/types/control/LayerSwitcher.d.ts +3 -5
  168. package/types/control/Lighting.d.ts +3 -3
  169. package/types/control/MouseNavigation.d.ts +47 -0
  170. package/types/control/ScaleControl.d.ts +3 -3
  171. package/types/control/ShowFps.d.ts +3 -4
  172. package/types/control/SimpleNavigation.d.ts +3 -6
  173. package/types/control/Sun.d.ts +8 -10
  174. package/types/control/ToggleWireframe.d.ts +3 -3
  175. package/types/control/TouchNavigation.d.ts +48 -0
  176. package/types/control/ZoomControl.d.ts +3 -4
  177. package/types/control/index.d.ts +3 -1
  178. package/types/ellipsoid/Ellipsoid.d.ts +47 -43
  179. package/types/ellipsoid/wgs84.d.ts +3 -2
  180. package/types/entity/BaseBillboard.d.ts +41 -34
  181. package/types/entity/Billboard.d.ts +7 -7
  182. package/types/entity/BillboardHandler.d.ts +4 -0
  183. package/types/entity/Entity.d.ts +101 -83
  184. package/types/entity/EntityCollection.d.ts +57 -43
  185. package/types/entity/GeoObject.d.ts +111 -0
  186. package/types/entity/GeoObjectHandler.d.ts +77 -0
  187. package/types/entity/Geometry.d.ts +9 -7
  188. package/types/entity/GeometryHandler.d.ts +2 -2
  189. package/types/entity/Label.d.ts +24 -29
  190. package/types/entity/LabelHandler.d.ts +9 -2
  191. package/types/entity/LabelWorker.d.ts +9 -0
  192. package/types/entity/PointCloud.d.ts +8 -8
  193. package/types/entity/PointCloudHandler.d.ts +3 -3
  194. package/types/entity/Polyline.d.ts +58 -55
  195. package/types/entity/Ray.d.ts +19 -18
  196. package/types/entity/Strip.d.ts +8 -7
  197. package/types/entity/StripHandler.d.ts +3 -3
  198. package/types/entity/index.d.ts +7 -7
  199. package/types/input/KeyboardHandler.d.ts +10 -0
  200. package/types/input/MouseHandler.d.ts +5 -0
  201. package/types/input/TouchHandler.d.ts +5 -0
  202. package/types/layer/BaseGeoImage.d.ts +23 -35
  203. package/types/layer/CanvasTiles.d.ts +15 -22
  204. package/types/layer/GeoImage.d.ts +5 -18
  205. package/types/layer/GeoVideo.d.ts +5 -30
  206. package/types/layer/KML.d.ts +20 -15
  207. package/types/layer/Layer.d.ts +326 -0
  208. package/types/layer/Material.d.ts +45 -0
  209. package/types/layer/Vector.d.ts +208 -0
  210. package/types/layer/WMS.d.ts +4 -7
  211. package/types/layer/XYZ.d.ts +19 -25
  212. package/types/light/LightSource.d.ts +54 -53
  213. package/types/math/Line2.d.ts +11 -0
  214. package/types/math/Line3.d.ts +10 -0
  215. package/types/math/Mat3.d.ts +30 -18
  216. package/types/math/Mat4.d.ts +71 -52
  217. package/types/math/Plane.d.ts +5 -4
  218. package/types/math/Quat.d.ts +379 -0
  219. package/types/math/Ray.d.ts +82 -0
  220. package/types/math/Vec2.d.ts +102 -101
  221. package/types/math/Vec3.d.ts +143 -142
  222. package/types/math/Vec4.d.ts +40 -39
  223. package/types/math/coder.d.ts +12 -11
  224. package/types/math.d.ts +8 -8
  225. package/types/mercator.d.ts +3 -3
  226. package/types/proj/EPSG3857.d.ts +3 -2
  227. package/types/proj/EPSG4326.d.ts +3 -2
  228. package/types/proj/Proj.d.ts +42 -0
  229. package/types/quadTree/EntityCollectionNode.d.ts +34 -0
  230. package/types/quadTree/Node.d.ts +61 -0
  231. package/types/renderer/Renderer.d.ts +300 -0
  232. package/types/renderer/RendererEvents.d.ts +10 -7
  233. package/types/scene/BaseNode.d.ts +9 -9
  234. package/types/scene/Planet.d.ts +131 -126
  235. package/types/scene/RenderNode.d.ts +22 -23
  236. package/types/segment/Segment.d.ts +279 -0
  237. package/types/segment/SegmentLonLat.d.ts +16 -0
  238. package/types/shaders/geoObject.d.ts +3 -0
  239. package/types/shapes/BaseShape.d.ts +43 -40
  240. package/types/shapes/Sphere.d.ts +7 -7
  241. package/types/terrain/BilTerrain.d.ts +0 -1
  242. package/types/terrain/EmptyTerrain.d.ts +4 -4
  243. package/types/terrain/GlobusTerrain.d.ts +17 -54
  244. package/types/terrain/MapboxTerrain.d.ts +0 -1
  245. package/types/utils/GeoImageCreator.d.ts +3 -2
  246. package/types/utils/TextureAtlas.d.ts +8 -8
  247. package/types/utils/shared.d.ts +25 -24
  248. package/types/webgl/Framebuffer.d.ts +5 -5
  249. package/types/webgl/Handler.d.ts +68 -43
  250. package/types/webgl/Multisample.d.ts +5 -5
  251. package/types/webgl/Program.d.ts +8 -2
  252. package/types/webgl/ProgramController.d.ts +18 -13
  253. package/src/og/inherits.js +0 -8
  254. package/src/og/utils/polylabel.js +0 -176
  255. package/types/inherits.d.ts +0 -4
@@ -2,21 +2,21 @@
2
2
  * @module og/entity/BaseBillboard
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import * as utils from '../utils/shared.js';
8
- import { Vec3 } from '../math/Vec3.js';
9
- import { Entity } from './Entity.js';
10
- import { doubleToTwoFloats2 } from '../math/coder.js';
7
+ import * as utils from "../utils/shared.js";
8
+ import { Vec3 } from "../math/Vec3.js";
9
+ import { Entity } from "./Entity.js";
10
+ import { doubleToTwoFloats2 } from "../math/coder.js";
11
11
 
12
12
  /**
13
13
  * Ray class.
14
14
  * @class
15
15
  * @param {Object} [options] - Options:
16
- * @param {og.Vec3|Array.<number>} [options.startPosition] - Ray start point position.
17
- * @param {og.Vec3|Array.<number>} [options.endPosition] - Ray end point position.
18
- * @param {og.Vec3|Array.<number>} [options.startColor] - Ray start point color.
19
- * @param {og.Vec3|Array.<number>} [options.endColor] - Ray end point color.
16
+ * @param {Vec3|Array.<number>} [options.startPosition] - Ray start point position.
17
+ * @param {Vec3|Array.<number>} [options.endPosition] - Ray end point position.
18
+ * @param {Vec3|Array.<number>} [options.startColor] - Ray start point color.
19
+ * @param {Vec3|Array.<number>} [options.endColor] - Ray end point color.
20
20
  * @param {boolean} [options.visibility] - Visibility.
21
21
  */
22
22
  class Ray {
@@ -43,7 +43,11 @@ class Ray {
43
43
  this._startPosition = utils.createVector3(options.startPosition);
44
44
  this._startPositionHigh = new Vec3();
45
45
  this._startPositionLow = new Vec3();
46
- Vec3.doubleToTwoFloats(this._startPosition, this._startPositionHigh, this._startPositionLow);
46
+ Vec3.doubleToTwoFloats(
47
+ this._startPosition,
48
+ this._startPositionHigh,
49
+ this._startPositionLow
50
+ );
47
51
 
48
52
  // RTE end position
49
53
  this._endPosition = utils.createVector3(options.endPosition);
@@ -65,14 +69,14 @@ class Ray {
65
69
  /**
66
70
  * Entity instance that holds this billboard.
67
71
  * @protected
68
- * @type {og.Entity}
72
+ * @type {Entity}
69
73
  */
70
74
  this._entity = null;
71
75
 
72
76
  /**
73
77
  * Handler that stores and renders this billboard object.
74
78
  * @protected
75
- * @type {og.BillboardHandler}
79
+ * @type {BillboardHandler}
76
80
  */
77
81
  this._handler = null;
78
82
 
@@ -95,21 +99,39 @@ class Ray {
95
99
  this._startPosition.x = x;
96
100
  this._startPosition.y = y;
97
101
  this._startPosition.z = z;
98
- Vec3.doubleToTwoFloats(this._startPosition, this._startPositionHigh, this._startPositionLow);
99
- this._handler && this._handler.setStartPositionArr(this._handlerIndex, this._startPositionHigh, this._startPositionLow);
102
+ Vec3.doubleToTwoFloats(
103
+ this._startPosition,
104
+ this._startPositionHigh,
105
+ this._startPositionLow
106
+ );
107
+ this._handler &&
108
+ this._handler.setStartPositionArr(
109
+ this._handlerIndex,
110
+ this._startPositionHigh,
111
+ this._startPositionLow
112
+ );
100
113
  }
101
114
 
102
115
  /**
103
116
  * Sets ray start position.
104
117
  * @public
105
- * @param {og.Vec3} position - Cartesian coordinates.
118
+ * @param {Vec3} position - Cartesian coordinates.
106
119
  */
107
120
  setStartPosition3v(position) {
108
121
  this._startPosition.x = position.x;
109
122
  this._startPosition.y = position.y;
110
123
  this._startPosition.z = position.z;
111
- Vec3.doubleToTwoFloats(this._startPosition, this._startPositionHigh, this._startPositionLow);
112
- this._handler && this._handler.setStartPositionArr(this._handlerIndex, this._startPositionHigh, this._startPositionLow);
124
+ Vec3.doubleToTwoFloats(
125
+ this._startPosition,
126
+ this._startPositionHigh,
127
+ this._startPositionLow
128
+ );
129
+ this._handler &&
130
+ this._handler.setStartPositionArr(
131
+ this._handlerIndex,
132
+ this._startPositionHigh,
133
+ this._startPositionLow
134
+ );
113
135
  }
114
136
 
115
137
  /**
@@ -124,20 +146,30 @@ class Ray {
124
146
  this._endPosition.y = y;
125
147
  this._endPosition.z = z;
126
148
  Vec3.doubleToTwoFloats(this._endPosition, this._endPositionHigh, this._endPositionLow);
127
- this._handler && this._handler.setEndPositionArr(this._handlerIndex, this._endPositionHigh, this._endPositionLow);
149
+ this._handler &&
150
+ this._handler.setEndPositionArr(
151
+ this._handlerIndex,
152
+ this._endPositionHigh,
153
+ this._endPositionLow
154
+ );
128
155
  }
129
156
 
130
157
  /**
131
158
  * Sets ray end position.
132
159
  * @public
133
- * @param {og.Vec3} position - Cartesian coordinates.
160
+ * @param {Vec3} position - Cartesian coordinates.
134
161
  */
135
162
  setEndPosition3v(position) {
136
163
  this._endPosition.x = position.x;
137
164
  this._endPosition.y = position.y;
138
165
  this._endPosition.z = position.z;
139
166
  Vec3.doubleToTwoFloats(this._endPosition, this._endPositionHigh, this._endPositionLow);
140
- this._handler && this._handler.setEndPositionArr(this._handlerIndex, this._endPositionHigh, this._endPositionLow);
167
+ this._handler &&
168
+ this._handler.setEndPositionArr(
169
+ this._handlerIndex,
170
+ this._endPositionHigh,
171
+ this._endPositionLow
172
+ );
141
173
  }
142
174
 
143
175
  setLength(length) {
@@ -165,11 +197,11 @@ class Ray {
165
197
  this._endColor.w = endColor.w;
166
198
  }
167
199
 
168
- this._handler && this._handler.setRgbaArr(this._handlerIndex, this._startColor, this._endColor);
200
+ this._handler &&
201
+ this._handler.setRgbaArr(this._handlerIndex, this._startColor, this._endColor);
169
202
  }
170
203
 
171
204
  setColorsHTML(startColor, endColor) {
172
-
173
205
  if (startColor) {
174
206
  this._startColor = utils.htmlColorToRgba(startColor);
175
207
  }
@@ -178,13 +210,14 @@ class Ray {
178
210
  this._endColor = utils.htmlColorToRgba(endColor);
179
211
  }
180
212
 
181
- this._handler && this._handler.setRgbaArr(this._handlerIndex, this._startColor, this._endColor);
213
+ this._handler &&
214
+ this._handler.setRgbaArr(this._handlerIndex, this._startColor, this._endColor);
182
215
  }
183
216
 
184
217
  /**
185
218
  * Returns ray start position.
186
219
  * @public
187
- * @returns {og.Vec3}
220
+ * @returns {Vec3}
188
221
  */
189
222
  getStartPosition() {
190
223
  return this._startPosition;
@@ -193,7 +226,7 @@ class Ray {
193
226
  /**
194
227
  * Returns ray end position.
195
228
  * @public
196
- * @returns {og.Vec3}
229
+ * @returns {Vec3}
197
230
  */
198
231
  getEndPosition() {
199
232
  return this._endPosition;
@@ -230,11 +263,11 @@ class Ray {
230
263
  /**
231
264
  * Sets billboard picking color.
232
265
  * @public
233
- * @param {og.Vec3} color - Picking color.
266
+ * @param {Vec3} color - Picking color.
234
267
  */
235
268
  setPickingColor3v(color) {
236
269
  this._handler && this._handler.setPickingColorArr(this._handlerIndex, color);
237
270
  }
238
- };
271
+ }
239
272
 
240
- export { Ray };
273
+ export { Ray };
@@ -94,6 +94,6 @@ class ShapeHandler {
94
94
  this._shapes.length = 0;
95
95
  this._shapes = [];
96
96
  }
97
- };
97
+ }
98
98
 
99
99
  export { ShapeHandler };
@@ -1,8 +1,8 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- import * as utils from '../utils/shared.js';
4
- import { Vec3 } from '../math/Vec3.js';
5
- import { Line3 } from '../math/Line3.js';
3
+ import * as utils from "../utils/shared.js";
4
+ import { Vec3 } from "../math/Vec3.js";
5
+ import { Line3 } from "../math/Line3.js";
6
6
 
7
7
  let _tempHigh = new Vec3(),
8
8
  _tempLow = new Vec3();
@@ -25,7 +25,6 @@ let _tempHigh = new Vec3(),
25
25
  */
26
26
  class Strip {
27
27
  constructor(options) {
28
-
29
28
  options = options || {};
30
29
 
31
30
  /**
@@ -41,7 +40,7 @@ class Strip {
41
40
  * @public
42
41
  * @type {boolean}
43
42
  */
44
- this.visibility = (options.visibility != undefined ? options.visibility : true);
43
+ this.visibility = options.visibility != undefined ? options.visibility : true;
45
44
 
46
45
  this.color = new Float32Array([1.0, 1.0, 1.0, 0.5]);
47
46
 
@@ -57,14 +56,14 @@ class Strip {
57
56
  /**
58
57
  * Parent collection render node.
59
58
  * @private
60
- * @type {og.scene.RenderNode}
59
+ * @type {RenderNode}
61
60
  */
62
61
  this._renderNode = null;
63
62
 
64
63
  /**
65
64
  * Entity instance that holds this strip.
66
65
  * @private
67
- * @type {og.Entity}
66
+ * @type {Entity}
68
67
  */
69
68
  this._entity = null;
70
69
 
@@ -87,7 +86,7 @@ class Strip {
87
86
  /**
88
87
  * Handler that stores and renders this object.
89
88
  * @private
90
- * @type {og.StripHandler}
89
+ * @type {StripHandler}
91
90
  */
92
91
  this._handler = null;
93
92
  this._handlerIndex = -1;
@@ -111,7 +110,7 @@ class Strip {
111
110
  /**
112
111
  * Assign picking color.
113
112
  * @protected
114
- * @param {og.Vec3} color - Picking RGB color.
113
+ * @param {Vec3} color - Picking RGB color.
115
114
  */
116
115
  setPickingColor3v(color) {
117
116
  this._pickingColor[0] = color.x / 255.0;
@@ -125,7 +124,6 @@ class Strip {
125
124
  * @public
126
125
  */
127
126
  clear() {
128
-
129
127
  this._path.length = 0;
130
128
  this._path = [];
131
129
 
@@ -177,7 +175,7 @@ class Strip {
177
175
  /**
178
176
  * Assign rendering scene node.
179
177
  * @public
180
- * @param {og.scene.RenderNode} renderNode - Assigned render node.
178
+ * @param {RenderNode} renderNode - Assigned render node.
181
179
  */
182
180
  setRenderNode(renderNode) {
183
181
  this._renderNode = renderNode;
@@ -219,11 +217,30 @@ class Strip {
219
217
  gl.uniform4fv(shu.uColor, this.color);
220
218
  gl.uniform1f(shu.uOpacity, this._entity._entityCollection._fadingOpacity);
221
219
  gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesHighBuffer);
222
- gl.vertexAttribPointer(sha.aVertexPositionHigh, this._verticesHighBuffer.itemSize, gl.FLOAT, false, 0, 0);
220
+ gl.vertexAttribPointer(
221
+ sha.aVertexPositionHigh,
222
+ this._verticesHighBuffer.itemSize,
223
+ gl.FLOAT,
224
+ false,
225
+ 0,
226
+ 0
227
+ );
223
228
  gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesLowBuffer);
224
- gl.vertexAttribPointer(sha.aVertexPositionLow, this._verticesLowBuffer.itemSize, gl.FLOAT, false, 0, 0);
229
+ gl.vertexAttribPointer(
230
+ sha.aVertexPositionLow,
231
+ this._verticesLowBuffer.itemSize,
232
+ gl.FLOAT,
233
+ false,
234
+ 0,
235
+ 0
236
+ );
225
237
  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
226
- gl.drawElements(r.handler.gl.TRIANGLE_STRIP, this._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
238
+ gl.drawElements(
239
+ r.handler.gl.TRIANGLE_STRIP,
240
+ this._indexBuffer.numItems,
241
+ gl.UNSIGNED_INT,
242
+ 0
243
+ );
227
244
  gl.enable(gl.CULL_FACE);
228
245
  }
229
246
  }
@@ -254,11 +271,30 @@ class Strip {
254
271
 
255
272
  gl.uniform4fv(shu.uColor, this._pickingColor);
256
273
  gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesHighBuffer);
257
- gl.vertexAttribPointer(sha.aVertexPositionHigh, this._verticesHighBuffer.itemSize, gl.FLOAT, false, 0, 0);
274
+ gl.vertexAttribPointer(
275
+ sha.aVertexPositionHigh,
276
+ this._verticesHighBuffer.itemSize,
277
+ gl.FLOAT,
278
+ false,
279
+ 0,
280
+ 0
281
+ );
258
282
  gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesLowBuffer);
259
- gl.vertexAttribPointer(sha.aVertexPositionLow, this._verticesLowBuffer.itemSize, gl.FLOAT, false, 0, 0);
283
+ gl.vertexAttribPointer(
284
+ sha.aVertexPositionLow,
285
+ this._verticesLowBuffer.itemSize,
286
+ gl.FLOAT,
287
+ false,
288
+ 0,
289
+ 0
290
+ );
260
291
  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
261
- gl.drawElements(r.handler.gl.TRIANGLE_STRIP, this._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
292
+ gl.drawElements(
293
+ r.handler.gl.TRIANGLE_STRIP,
294
+ this._indexBuffer.numItems,
295
+ gl.UNSIGNED_INT,
296
+ 0
297
+ );
262
298
  gl.enable(gl.CULL_FACE);
263
299
  }
264
300
  }
@@ -289,9 +325,21 @@ class Strip {
289
325
  gl.deleteBuffer(this._verticesHighBuffer);
290
326
  gl.deleteBuffer(this._verticesLowBuffer);
291
327
 
292
- this._verticesHighBuffer = this._renderNode.renderer.handler.createArrayBuffer(new Float32Array(this._verticesHigh), 3, this._verticesHigh.length / 3);
293
- this._verticesLowBuffer = this._renderNode.renderer.handler.createArrayBuffer(new Float32Array(this._verticesLow), 3, this._verticesLow.length / 3);
294
- this._indexBuffer = this._renderNode.renderer.handler.createElementArrayBuffer(new Uint32Array(this._indexes), 1, this._indexes.length);
328
+ this._verticesHighBuffer = this._renderNode.renderer.handler.createArrayBuffer(
329
+ new Float32Array(this._verticesHigh),
330
+ 3,
331
+ this._verticesHigh.length / 3
332
+ );
333
+ this._verticesLowBuffer = this._renderNode.renderer.handler.createArrayBuffer(
334
+ new Float32Array(this._verticesLow),
335
+ 3,
336
+ this._verticesLow.length / 3
337
+ );
338
+ this._indexBuffer = this._renderNode.renderer.handler.createElementArrayBuffer(
339
+ new Uint32Array(this._indexes),
340
+ 1,
341
+ this._indexes.length
342
+ );
295
343
  }
296
344
  }
297
345
 
@@ -299,11 +347,8 @@ class Strip {
299
347
  let length = this._path.length;
300
348
 
301
349
  if (length === 0) {
302
-
303
350
  this._path.push([p2.clone(), p3.clone()]);
304
-
305
351
  } else {
306
-
307
352
  let p0 = this._path[length - 1][0],
308
353
  p1 = this._path[length - 1][1];
309
354
 
@@ -323,19 +368,17 @@ class Strip {
323
368
  let d = Math.abs(p0.sub(p1).normal().dot(p2.sub(p0).normal()));
324
369
 
325
370
  for (let i = 0; i < gs1; i++) {
326
-
327
371
  let di = i / gs;
328
372
  let p02 = p0.lerp(p2, di),
329
373
  p13 = p1.lerp(p3, di);
330
374
 
331
375
  for (let j = 0; j < gs1; j++) {
332
-
333
376
  let dj = j / gs;
334
377
  let p01 = p0.lerp(p1, dj),
335
378
  p23 = p2.lerp(p3, dj);
336
379
 
337
380
  if (d !== 1.0) {
338
- (new Line3(p02, p13)).intersects(new Line3(p01, p23), p);
381
+ new Line3(p02, p13).intersects(new Line3(p01, p23), p);
339
382
  } else {
340
383
  p = p23;
341
384
  }
@@ -369,17 +412,15 @@ class Strip {
369
412
  }
370
413
 
371
414
  setEdge3v(p2, p3, index) {
372
-
373
415
  if (index === this._path.length) {
374
416
  this.addEdge3v(p2, p3);
375
417
  return;
376
- } if (this._path[index]) {
377
-
418
+ }
419
+ if (this._path[index]) {
378
420
  this._path[index][0] = p2;
379
421
  this._path[index][1] = p3;
380
422
 
381
423
  if (this._path.length > 1) {
382
-
383
424
  let gs = this._gridSize,
384
425
  gs1 = gs + 1;
385
426
 
@@ -391,7 +432,6 @@ class Strip {
391
432
  vLow = this._verticesLow;
392
433
 
393
434
  if (index === this._path.length - 1) {
394
-
395
435
  let p0 = this._path[index - 1][0],
396
436
  p1 = this._path[index - 1][1];
397
437
 
@@ -401,19 +441,17 @@ class Strip {
401
441
  let d = Math.abs(p0.sub(p1).normal().dot(p2.sub(p0).normal()));
402
442
 
403
443
  for (let i = 0; i < gs1; i++) {
404
-
405
444
  let di = i / gs;
406
445
  let p02 = p0.lerp(p2, di),
407
446
  p13 = p1.lerp(p3, di);
408
447
 
409
448
  for (let j = 0; j < gs1; j++) {
410
-
411
449
  let dj = j / gs;
412
450
  let p01 = p0.lerp(p1, dj),
413
451
  p23 = p2.lerp(p3, dj);
414
452
 
415
453
  if (d !== 1.0) {
416
- (new Line3(p02, p13)).intersects(new Line3(p01, p23), p);
454
+ new Line3(p02, p13).intersects(new Line3(p01, p23), p);
417
455
  } else {
418
456
  p = p23;
419
457
  }
@@ -433,9 +471,7 @@ class Strip {
433
471
  vLow[ind3 + 2] = _tempLow.z;
434
472
  }
435
473
  }
436
-
437
474
  } else if (index === 0) {
438
-
439
475
  let ind = 0;
440
476
 
441
477
  let p0 = p2,
@@ -445,18 +481,16 @@ class Strip {
445
481
  p3 = this._path[1][1];
446
482
 
447
483
  for (let i = 0; i < gs1; i++) {
448
-
449
484
  let di = i / gs;
450
485
  let p02 = p0.lerp(p2, di),
451
486
  p13 = p1.lerp(p3, di);
452
487
 
453
488
  for (let j = 0; j < gs1; j++) {
454
-
455
489
  let dj = j / gs;
456
490
  let p01 = p0.lerp(p1, dj),
457
491
  p23 = p2.lerp(p3, dj);
458
492
 
459
- (new Line3(p02, p13)).intersects(new Line3(p01, p23), p);
493
+ new Line3(p02, p13).intersects(new Line3(p01, p23), p);
460
494
 
461
495
  ind = i * gs1 + j;
462
496
 
@@ -474,7 +508,6 @@ class Strip {
474
508
  }
475
509
  }
476
510
  } else if (index > 0 && index < this._path.length) {
477
-
478
511
  let p0 = this._path[index - 1][0],
479
512
  p1 = this._path[index - 1][1];
480
513
 
@@ -486,7 +519,6 @@ class Strip {
486
519
  ind = prev;
487
520
 
488
521
  for (let i = 0; i < gs1; i++) {
489
-
490
522
  let di = i / gs;
491
523
  let p02 = p0.lerp(p2, di),
492
524
  p35 = p3.lerp(p5, di),
@@ -494,13 +526,12 @@ class Strip {
494
526
  p13 = p1.lerp(p3, di);
495
527
 
496
528
  for (let j = 0; j < gs1; j++) {
497
-
498
529
  let dj = j / gs;
499
530
  let p01 = p0.lerp(p1, dj),
500
531
  p23 = p2.lerp(p3, dj);
501
532
 
502
533
  // prev
503
- (new Line3(p02, p13)).intersects(new Line3(p01, p23), p);
534
+ new Line3(p02, p13).intersects(new Line3(p01, p23), p);
504
535
 
505
536
  let ij = i * gs1 + j;
506
537
 
@@ -523,7 +554,7 @@ class Strip {
523
554
 
524
555
  p23 = p2.lerp(p3, dj);
525
556
 
526
- (new Line3(p24, p35)).intersects(new Line3(p23, p45), p);
557
+ new Line3(p24, p35).intersects(new Line3(p23, p45), p);
527
558
 
528
559
  ind = next + ij;
529
560
 
@@ -564,14 +595,12 @@ class Strip {
564
595
  }
565
596
 
566
597
  setPath(path) {
567
-
568
598
  this._verticesHigh = [];
569
599
  this._verticesLow = [];
570
600
  this._indexes = [];
571
601
  this._path = [];
572
602
 
573
603
  for (let i = 0; i < path.length; i++) {
574
-
575
604
  let p0 = path[i][0],
576
605
  p1 = path[i][1];
577
606
 
@@ -598,4 +627,4 @@ class Strip {
598
627
  }
599
628
  }
600
629
 
601
- export { Strip };
630
+ export { Strip };
@@ -1,10 +1,9 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- import { Program } from '../webgl/Program.js';
3
+ import { Program } from "../webgl/Program.js";
4
4
 
5
5
  class StripHandler {
6
6
  constructor(entityCollection) {
7
-
8
7
  /**
9
8
  * Picking rendering option.
10
9
  * @public
@@ -15,21 +14,21 @@ class StripHandler {
15
14
  /**
16
15
  * Parent collection
17
16
  * @private
18
- * @type {og.EntityCollection}
17
+ * @type {EntityCollection}
19
18
  */
20
19
  this._entityCollection = entityCollection;
21
20
 
22
21
  /**
23
22
  * Renderer
24
23
  * @private
25
- * @type {og.Renderer}
24
+ * @type {Renderer}
26
25
  */
27
26
  this._renderer = null;
28
27
 
29
28
  /**
30
29
  * Point cloud array
31
30
  * @private
32
- * @type {Array.<og.Strip>}
31
+ * @type {Array.<Strip>}
33
32
  */
34
33
  this._strips = [];
35
34
 
@@ -50,21 +49,21 @@ class StripHandler {
50
49
  _initProgram() {
51
50
  if (this._renderer.handler) {
52
51
  !this._renderer.handler.programs.strip &&
53
- this._renderer.handler.addProgram(new Program("strip", {
54
- uniforms: {
55
- projectionMatrix: { type: 'mat4' },
56
- viewMatrix: { type: 'mat4' },
57
- eyePositionHigh: "vec3",
58
- eyePositionLow: "vec3",
59
- uColor: { type: 'vec4' },
60
- uOpacity: { type: 'float' }
61
- },
62
- attributes: {
63
- aVertexPositionHigh: { type: 'vec3' },
64
- aVertexPositionLow: { type: 'vec3' }
65
- },
66
- vertexShader:
67
- `attribute vec3 aVertexPositionHigh;
52
+ this._renderer.handler.addProgram(
53
+ new Program("strip", {
54
+ uniforms: {
55
+ projectionMatrix: { type: "mat4" },
56
+ viewMatrix: { type: "mat4" },
57
+ eyePositionHigh: "vec3",
58
+ eyePositionLow: "vec3",
59
+ uColor: { type: "vec4" },
60
+ uOpacity: { type: "float" }
61
+ },
62
+ attributes: {
63
+ aVertexPositionHigh: { type: "vec3" },
64
+ aVertexPositionLow: { type: "vec3" }
65
+ },
66
+ vertexShader: `attribute vec3 aVertexPositionHigh;
68
67
  attribute vec3 aVertexPositionLow;
69
68
  uniform mat4 projectionMatrix;
70
69
  uniform mat4 viewMatrix;
@@ -80,14 +79,14 @@ class StripHandler {
80
79
 
81
80
  gl_Position = projectionMatrix * viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
82
81
  }`,
83
- fragmentShader:
84
- `precision highp float;
82
+ fragmentShader: `precision highp float;
85
83
  uniform vec4 uColor;
86
84
  uniform float uOpacity;
87
85
  void main(void) {
88
86
  gl_FragColor = vec4(uColor.rgb, uColor.a * uOpacity);
89
87
  }`
90
- }));
88
+ })
89
+ );
91
90
  }
92
91
  }
93
92
 
@@ -104,7 +103,8 @@ class StripHandler {
104
103
  strip._handler = this;
105
104
  strip._handlerIndex = this._strips.length;
106
105
  this._strips.push(strip);
107
- this._entityCollection && this._entityCollection.renderNode &&
106
+ this._entityCollection &&
107
+ this._entityCollection.renderNode &&
108
108
  strip.setRenderNode(this._entityCollection.renderNode);
109
109
  }
110
110
  }
@@ -153,6 +153,6 @@ class StripHandler {
153
153
  this._strips.length = 0;
154
154
  this._strips = [];
155
155
  }
156
- };
156
+ }
157
157
 
158
- export { StripHandler };
158
+ export { StripHandler };
@@ -1,17 +1,9 @@
1
- import { Entity } from './Entity';
2
- import { EntityCollection } from './EntityCollection';
3
- import { Billboard } from './Billboard';
4
- import { Geometry } from './Geometry';
5
- import { Label } from './Label';
6
- import { PointCloud } from './PointCloud';
7
- import { Polyline } from './Polyline';
1
+ import { Entity } from "./Entity.js";
2
+ import { EntityCollection } from "./EntityCollection.js";
3
+ import { Billboard } from "./Billboard.js";
4
+ import { Geometry } from "./Geometry.js";
5
+ import { Label } from "./Label.js";
6
+ import { PointCloud } from "./PointCloud.js";
7
+ import { Polyline } from "./Polyline.js";
8
8
 
9
- export {
10
- Entity,
11
- EntityCollection,
12
- Billboard,
13
- Geometry,
14
- Label,
15
- PointCloud,
16
- Polyline
17
- };
9
+ export { Entity, EntityCollection, Billboard, Geometry, Label, PointCloud, Polyline };