@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,20 +2,20 @@
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';
7
+ import * as utils from "../utils/shared.js";
8
+ import { Vec3 } from "../math/Vec3.js";
9
9
 
10
10
  /**
11
11
  * Base prototype for billboard and label classes.
12
12
  * @class
13
13
  * @param {Object} [options] - Options:
14
- * @param {og.Vec3|Array.<number>} [options.position] - Billboard spatial position.
14
+ * @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
15
15
  * @param {number} [options.rotation] - Screen angle rotaion.
16
- * @param {og.Vec4|string|Array.<number>} [options.color] - Billboard color.
17
- * @param {og.Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
18
- * @param {og.Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
16
+ * @param {Vec4|string|Array.<number>} [options.color] - Billboard color.
17
+ * @param {Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
18
+ * @param {Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
19
19
  * @param {boolean} [options.visibility] - Visibility.
20
20
  */
21
21
  class BaseBillboard {
@@ -33,14 +33,14 @@ class BaseBillboard {
33
33
  /**
34
34
  * Billboard center cartesian position.
35
35
  * @protected
36
- * @type {og.Vec3}
36
+ * @type {Vec3}
37
37
  */
38
38
  this._position = utils.createVector3(options.position);
39
39
 
40
40
  this._positionHigh = new Vec3();
41
-
41
+
42
42
  this._positionLow = new Vec3();
43
-
43
+
44
44
  Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
45
45
 
46
46
  /**
@@ -53,21 +53,21 @@ class BaseBillboard {
53
53
  /**
54
54
  * RGBA color.
55
55
  * @protected
56
- * @type {og.Vec4}
56
+ * @type {Vec4}
57
57
  */
58
58
  this._color = utils.createColorRGBA(options.color);
59
59
 
60
60
  /**
61
61
  * Cartesian aligned axis vector.
62
62
  * @protected
63
- * @type {og.Vec3}
63
+ * @type {Vec3}
64
64
  */
65
65
  this._alignedAxis = utils.createVector3(options.alignedAxis);
66
66
 
67
67
  /**
68
68
  * Billboard center screen space offset. Where x,y - screen space offset and z - depth offset.
69
69
  * @protected
70
- * @type {og.math.Vecto3}
70
+ * @type {math.Vecto3}
71
71
  */
72
72
  this._offset = utils.createVector3(options.offset);
73
73
 
@@ -81,14 +81,14 @@ class BaseBillboard {
81
81
  /**
82
82
  * Entity instance that holds this billboard.
83
83
  * @protected
84
- * @type {og.Entity}
84
+ * @type {Entity}
85
85
  */
86
86
  this._entity = null;
87
87
 
88
88
  /**
89
89
  * Handler that stores and renders this billboard object.
90
90
  * @protected
91
- * @type {og.BillboardHandler}
91
+ * @type {BillboardHandler}
92
92
  */
93
93
  this._handler = null;
94
94
 
@@ -97,7 +97,16 @@ class BaseBillboard {
97
97
  * @protected
98
98
  * @type {number}
99
99
  */
100
- this._handlerIndex = -1;
100
+ this._handlerIndex = -1;
101
+
102
+ /**
103
+ * An indication that the object is ready to draw
104
+ * @protected
105
+ * @type {number}
106
+ */
107
+ this._isReady = false;
108
+
109
+ this._lockId = -1;
101
110
  }
102
111
 
103
112
  static get _staticCounter() {
@@ -121,28 +130,36 @@ class BaseBillboard {
121
130
  setPosition(x, y, z) {
122
131
  this._position.x = x;
123
132
  this._position.y = y;
124
- this._position.z = z;
125
- Vec3.doubleToTwoFloats(position, this._positionHigh, this._positionLow);
126
- this._handler && this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
133
+ this._position.z = z;
134
+ Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
135
+ if (this._isReady) {
136
+ this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
137
+ } else if (this._lockId !== -1) {
138
+ this._lockId = -2;
139
+ }
127
140
  }
128
141
 
129
142
  /**
130
143
  * Sets billboard position.
131
144
  * @public
132
- * @param {og.Vec3} position - Cartesian coordinates.
145
+ * @param {Vec3} position - Cartesian coordinates.
133
146
  */
134
147
  setPosition3v(position) {
135
148
  this._position.x = position.x;
136
149
  this._position.y = position.y;
137
150
  this._position.z = position.z;
138
151
  Vec3.doubleToTwoFloats(position, this._positionHigh, this._positionLow);
139
- this._handler && this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
152
+ if (this._isReady) {
153
+ this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
154
+ } else if (this._lockId !== -1) {
155
+ this._lockId = -2;
156
+ }
140
157
  }
141
158
 
142
159
  /**
143
160
  * Returns billboard position.
144
161
  * @public
145
- * @returns {og.Vec3}
162
+ * @returns {Vec3}
146
163
  */
147
164
  getPosition() {
148
165
  return this._position;
@@ -158,26 +175,34 @@ class BaseBillboard {
158
175
  setOffset(x, y, z) {
159
176
  this._offset.x = x;
160
177
  this._offset.y = y;
161
- (z != undefined) && (this._offset.z = z);
162
- this._handler && this._handler.setOffsetArr(this._handlerIndex, this._offset);
178
+ z != undefined && (this._offset.z = z);
179
+ if (this._isReady) {
180
+ this._handler.setOffsetArr(this._handlerIndex, this._offset);
181
+ } else if (this._lockId !== -1) {
182
+ this._lockId = -2;
183
+ }
163
184
  }
164
185
 
165
186
  /**
166
187
  * Sets screen space offset.
167
188
  * @public
168
- * @param {og.Vec2} offset - Offset size.
189
+ * @param {Vec2} offset - Offset size.
169
190
  */
170
191
  setOffset3v(offset) {
171
192
  this._offset.x = offset.x;
172
193
  this._offset.y = offset.y;
173
- (offset.z != undefined) && (this._offset.z = offset.z);
174
- this._handler && this._handler.setOffsetArr(this._handlerIndex, offset);
194
+ offset.z != undefined && (this._offset.z = offset.z);
195
+ if (this._isReady) {
196
+ this._handler.setOffsetArr(this._handlerIndex, offset);
197
+ } else if (this._lockId !== -1) {
198
+ this._lockId = -2;
199
+ }
175
200
  }
176
201
 
177
202
  /**
178
203
  * Returns billboard screen space offset size.
179
204
  * @public
180
- * @returns {og.Vec3}
205
+ * @returns {Vec3}
181
206
  */
182
207
  getOffset() {
183
208
  return this._offset;
@@ -190,7 +215,11 @@ class BaseBillboard {
190
215
  */
191
216
  setRotation(rotation) {
192
217
  this._rotation = rotation;
193
- this._handler && this._handler.setRotationArr(this._handlerIndex, rotation);
218
+ if (this._isReady) {
219
+ this._handler.setRotationArr(this._handlerIndex, rotation);
220
+ } else if (this._lockId !== -1) {
221
+ this._lockId = -2;
222
+ }
194
223
  }
195
224
 
196
225
  /**
@@ -224,21 +253,29 @@ class BaseBillboard {
224
253
  this._color.x = r;
225
254
  this._color.y = g;
226
255
  this._color.z = b;
227
- (a != undefined) && (this._color.w = a);
228
- this._handler && this._handler.setRgbaArr(this._handlerIndex, this._color);
256
+ a != undefined && (this._color.w = a);
257
+ if (this._isReady) {
258
+ this._handler.setRgbaArr(this._handlerIndex, this._color);
259
+ } else if (this._lockId !== -1) {
260
+ this._lockId = -2;
261
+ }
229
262
  }
230
263
 
231
264
  /**
232
265
  * Sets RGBA color. Each channel from 0.0 to 1.0.
233
266
  * @public
234
- * @param {og.Vec4} color - RGBA vector.
267
+ * @param {Vec4} color - RGBA vector.
235
268
  */
236
269
  setColor4v(color) {
237
270
  this._color.x = color.x;
238
271
  this._color.y = color.y;
239
272
  this._color.z = color.z;
240
- (color.w != undefined) && (this._color.w = color.w);
241
- this._handler && this._handler.setRgbaArr(this._handlerIndex, color);
273
+ color.w != undefined && (this._color.w = color.w);
274
+ if (this._isReady) {
275
+ this._handler.setRgbaArr(this._handlerIndex, color);
276
+ } else if (this._lockId !== -1) {
277
+ this._lockId = -2;
278
+ }
242
279
  }
243
280
 
244
281
  /**
@@ -253,7 +290,7 @@ class BaseBillboard {
253
290
  /**
254
291
  * Returns RGBA color.
255
292
  * @public
256
- * @returns {og.Vec4}
293
+ * @returns {Vec4}
257
294
  */
258
295
  getColor() {
259
296
  return this._color;
@@ -266,7 +303,11 @@ class BaseBillboard {
266
303
  */
267
304
  setVisibility(visibility) {
268
305
  this._visibility = visibility;
269
- this._handler && this._handler.setVisibility(this._handlerIndex, visibility);
306
+ if (this._isReady) {
307
+ this._handler.setVisibility(this._handlerIndex, visibility);
308
+ } else if (this._lockId !== -1) {
309
+ this._lockId = -2;
310
+ }
270
311
  }
271
312
 
272
313
  /**
@@ -289,25 +330,33 @@ class BaseBillboard {
289
330
  this._alignedAxis.x = x;
290
331
  this._alignedAxis.y = y;
291
332
  this._alignedAxis.z = z;
292
- this._handler && this._handler.setAlignedAxisArr(this._handlerIndex, this._alignedAxis);
333
+ if (this._isReady) {
334
+ this._handler.setAlignedAxisArr(this._handlerIndex, this._alignedAxis);
335
+ } else if (this._lockId !== -1) {
336
+ this._lockId = -2;
337
+ }
293
338
  }
294
339
 
295
340
  /**
296
341
  * Sets billboard aligned vector.
297
342
  * @public
298
- * @param {og.math.Vecto3} alignedAxis - Vector to align.
343
+ * @param {math.Vecto3} alignedAxis - Vector to align.
299
344
  */
300
345
  setAlignedAxis3v(alignedAxis) {
301
346
  this._alignedAxis.x = alignedAxis.x;
302
347
  this._alignedAxis.y = alignedAxis.y;
303
348
  this._alignedAxis.z = alignedAxis.z;
304
- this._handler && this._handler.setAlignedAxisArr(this._handlerIndex, alignedAxis);
349
+ if (this._isReady) {
350
+ this._handler.setAlignedAxisArr(this._handlerIndex, alignedAxis);
351
+ } else if (this._lockId !== -1) {
352
+ this._lockId = -2;
353
+ }
305
354
  }
306
355
 
307
356
  /**
308
357
  * Returns aligned vector.
309
358
  * @public
310
- * @returns {og.Vec3}
359
+ * @returns {Vec3}
311
360
  */
312
361
  getAlignedAxis() {
313
362
  return this._alignedAxis;
@@ -325,11 +374,15 @@ class BaseBillboard {
325
374
  /**
326
375
  * Sets billboard picking color.
327
376
  * @public
328
- * @param {og.Vec3} color - Picking color.
377
+ * @param {Vec3} color - Picking color.
329
378
  */
330
379
  setPickingColor3v(color) {
331
- this._handler && this._handler.setPickingColorArr(this._handlerIndex, color);
380
+ if (this._isReady) {
381
+ this._handler.setPickingColorArr(this._handlerIndex, color);
382
+ } else if (this._lockId !== -1) {
383
+ this._lockId = -2;
384
+ }
332
385
  }
333
- };
386
+ }
334
387
 
335
- export { BaseBillboard };
388
+ export { BaseBillboard };
@@ -2,20 +2,20 @@
2
2
  * @module og/entity/Billboard
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { BaseBillboard } from './BaseBillboard.js';
7
+ import { BaseBillboard } from "./BaseBillboard.js";
8
8
 
9
9
  /**
10
10
  * Represents basic quad billboard image.
11
11
  * @class
12
- * @extends {og.BaseBillboard}
12
+ * @extends {BaseBillboard}
13
13
  * @param {Object} [options] - Options:
14
- * @param {og.Vec3|Array.<number>} [options.position] - Billboard spatial position.
14
+ * @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
15
15
  * @param {number} [options.rotation] - Screen angle rotaion.
16
- * @param {og.Vec4|string|Array.<number>} [options.color] - Billboard color.
17
- * @param {og.Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
18
- * @param {og.Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
16
+ * @param {Vec4|string|Array.<number>} [options.color] - Billboard color.
17
+ * @param {Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
18
+ * @param {Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
19
19
  * @param {boolean} [options.visibility] - Visibility.
20
20
  * @param {string} [options.src] - Billboard image url source.
21
21
  * @param {Image} [options.image] - Billboard image object.
@@ -76,7 +76,10 @@ class Billboard extends BaseBillboard {
76
76
  ta.loadImage(src, function (img) {
77
77
  if (ta.nodes[img.__nodeIndex]) {
78
78
  that._image = img;
79
- bh.setTexCoordArr(that._handlerIndex, ta.nodes[that._image.__nodeIndex].texCoords);
79
+ bh.setTexCoordArr(
80
+ that._handlerIndex,
81
+ ta.nodes[that._image.__nodeIndex].texCoords
82
+ );
80
83
  } else {
81
84
  ta.addImage(img);
82
85
  ta.createTexture();
@@ -106,7 +109,8 @@ class Billboard extends BaseBillboard {
106
109
  setSize(width, height) {
107
110
  this._width = width;
108
111
  this._height = height;
109
- this._handler && this._handler.setSizeArr(this._handlerIndex, width * this._scale, height * this._scale);
112
+ this._handler &&
113
+ this._handler.setSizeArr(this._handlerIndex, width * this._scale, height * this._scale);
110
114
  }
111
115
 
112
116
  /**
@@ -156,6 +160,6 @@ class Billboard extends BaseBillboard {
156
160
  getHeight() {
157
161
  return this._height;
158
162
  }
159
- };
163
+ }
160
164
 
161
- export { Billboard };
165
+ export { Billboard };