@openglobus/og 0.16.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/css/og.css +24 -2
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/Clock.js +1 -5
- package/src/og/Events.js +0 -4
- package/src/og/Extent.js +5 -9
- package/src/og/Globe.js +92 -55
- package/src/og/ImageCanvas.js +12 -5
- package/src/og/Lock.js +44 -48
- package/src/og/LonLat.js +0 -4
- package/src/og/Object3d.js +1 -1
- package/src/og/Stack.js +49 -53
- package/src/og/astro/earth.js +112 -116
- package/src/og/astro/jd.js +514 -518
- package/src/og/astro/orbit.js +119 -123
- package/src/og/astro/rotation.js +36 -40
- package/src/og/bv/Box.js +77 -81
- package/src/og/bv/Sphere.js +57 -61
- package/src/og/camera/Camera.js +20 -7
- package/src/og/camera/PlanetCamera.js +8 -15
- package/src/og/control/Atmosphere.js +0 -4
- package/src/og/control/Control.js +9 -8
- package/src/og/control/DebugInfo.js +0 -4
- package/src/og/control/DrawingSwitcher.js +117 -0
- package/src/og/control/EarthCoordinates.js +214 -214
- package/src/og/control/GeoImageDragControl.js +0 -4
- package/src/og/control/KeyboardNavigation.js +0 -4
- package/src/og/control/LayerAnimation.js +0 -4
- package/src/og/control/LayerSwitcher.js +2 -4
- package/src/og/control/Lighting.js +11 -15
- package/src/og/control/MouseNavigation.js +0 -4
- package/src/og/control/MouseWheelZoomControl.js +0 -4
- package/src/og/control/RulerSwitcher.js +0 -4
- package/src/og/control/ScaleControl.js +2 -6
- package/src/og/control/ShowFps.js +40 -44
- package/src/og/control/SimpleNavigation.js +10 -10
- package/src/og/control/SimpleSkyBackground.js +0 -4
- package/src/og/control/Sun.js +0 -4
- package/src/og/control/ToggleWireframe.js +35 -39
- package/src/og/control/ZoomControl.js +0 -4
- package/src/og/control/drawing/DrawingControl.js +51 -0
- package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
- package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
- package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
- package/src/og/control/index.js +5 -1
- package/src/og/control/ruler/Ruler.js +0 -4
- package/src/og/control/ruler/RulerScene.js +3 -2
- package/src/og/control/selection/Selection.js +0 -4
- package/src/og/control/selection/SelectionScene.js +2 -4
- package/src/og/control/timeline/TimelineControl.js +4 -4
- package/src/og/control/timeline/TimelineModel.js +2 -2
- package/src/og/control/timeline/TimelineView.js +1 -0
- package/src/og/control/visibleExtent/Segment.js +5 -5
- package/src/og/control/visibleExtent/drawnode.js +0 -4
- package/src/og/ellipsoid/Ellipsoid.js +205 -275
- package/src/og/ellipsoid/wgs84.js +0 -4
- package/src/og/entity/BaseBillboard.js +375 -379
- package/src/og/entity/Billboard.js +0 -4
- package/src/og/entity/BillboardHandler.js +0 -4
- package/src/og/entity/Entity.js +22 -22
- package/src/og/entity/EntityCollection.js +7 -11
- package/src/og/entity/GeoObject.js +0 -4
- package/src/og/entity/GeoObjectHandler.js +0 -4
- package/src/og/entity/Geometry.js +5 -4
- package/src/og/entity/GeometryHandler.js +3 -4
- package/src/og/entity/Label.js +0 -4
- package/src/og/entity/LabelHandler.js +0 -4
- package/src/og/entity/PointCloud.js +0 -4
- package/src/og/entity/PointCloudHandler.js +122 -126
- package/src/og/entity/Polyline.js +4 -6
- package/src/og/entity/PolylineHandler.js +104 -108
- package/src/og/entity/Ray.js +29 -29
- package/src/og/entity/Strip.js +1 -1
- package/src/og/index.js +3 -1
- package/src/og/input/KeyboardHandler.js +128 -132
- package/src/og/input/MouseHandler.js +94 -98
- package/src/og/input/TouchHandler.js +59 -63
- package/src/og/input/input.js +44 -48
- package/src/og/layer/BaseGeoImage.js +5 -8
- package/src/og/layer/CanvasTiles.js +0 -4
- package/src/og/layer/GeoImage.js +0 -4
- package/src/og/layer/GeoTexture2d.js +0 -4
- package/src/og/layer/GeoVideo.js +0 -4
- package/src/og/layer/KML.js +2 -3
- package/src/og/layer/Layer.js +22 -26
- package/src/og/layer/Material.js +0 -4
- package/src/og/layer/Vector.js +23 -20
- package/src/og/layer/WMS.js +182 -186
- package/src/og/layer/XYZ.js +0 -4
- package/src/og/light/LightSource.js +0 -4
- package/src/og/math/Line2.js +28 -32
- package/src/og/math/Mat3.js +152 -156
- package/src/og/math/Ray.js +0 -4
- package/src/og/math/Vec2.js +0 -4
- package/src/og/math/Vec3.js +0 -4
- package/src/og/math/Vec4.js +0 -4
- package/src/og/math/coder.js +104 -104
- package/src/og/math.js +39 -7
- package/src/og/proj/EPSG3857.js +13 -13
- package/src/og/proj/Proj.js +59 -63
- package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EntityCollectionNode.js +12 -16
- package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
- package/src/og/renderer/Renderer.js +109 -22
- package/src/og/renderer/RendererEvents.js +0 -4
- package/src/og/scene/Axes.js +74 -78
- package/src/og/scene/BaseNode.js +0 -4
- package/src/og/scene/Planet.js +114 -112
- package/src/og/scene/RenderNode.js +11 -3
- package/src/og/scene/SkyBox.js +104 -108
- package/src/og/segment/Segment.js +8 -4
- package/src/og/segment/SegmentLonLat.js +2 -6
- package/src/og/segment/segmentHelper.js +229 -225
- package/src/og/shaders/billboard.js +0 -4
- package/src/og/shaders/drawnode.js +5 -9
- package/src/og/shaders/geoObject.js +0 -4
- package/src/og/shaders/label.js +0 -4
- package/src/og/shaders/pickingMask.js +0 -4
- package/src/og/shaders/pointCloud.js +0 -4
- package/src/og/shaders/polyline.js +0 -4
- package/src/og/shaders/ray.js +0 -4
- package/src/og/shaders/skybox.js +0 -4
- package/src/og/terrain/EmptyTerrain.js +0 -4
- package/src/og/utils/FontAtlas.js +0 -4
- package/src/og/utils/GeoImageCreator.js +1 -2
- package/src/og/utils/NormalMapCreator.js +8 -9
- package/src/og/utils/VectorTileCreator.js +3 -9
- package/src/og/utils/shared.js +20 -1
- package/src/og/webgl/Framebuffer.js +0 -4
- package/src/og/webgl/Handler.js +45 -19
- package/src/og/webgl/Multisample.js +0 -4
- package/src/og/webgl/Program.js +0 -4
- package/src/og/webgl/ProgramController.js +2 -2
- package/types/Clock.d.ts +1 -1
- package/types/Extent.d.ts +5 -5
- package/types/Globe.d.ts +15 -1
- package/types/ImageCanvas.d.ts +5 -0
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +3 -3
- package/types/camera/Camera.d.ts +3 -2
- package/types/camera/PlanetCamera.d.ts +4 -4
- package/types/control/DrawingSwitcher.d.ts +13 -0
- package/types/control/EarthCoordinates.d.ts +1 -1
- package/types/control/Lighting.d.ts +8 -8
- package/types/control/drawing/DrawingControl.d.ts +14 -0
- package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
- package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
- package/types/control/index.d.ts +3 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/SelectionScene.d.ts +0 -1
- package/types/ellipsoid/Ellipsoid.d.ts +50 -63
- package/types/entity/Entity.d.ts +3 -2
- package/types/entity/Geometry.d.ts +5 -0
- package/types/entity/Polyline.d.ts +1 -1
- package/types/entity/Ray.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/layer/BaseGeoImage.d.ts +1 -1
- package/types/layer/CanvasTiles.d.ts +1 -1
- package/types/layer/Layer.d.ts +1 -1
- package/types/layer/Vector.d.ts +1 -0
- package/types/math.d.ts +7 -0
- package/types/renderer/Renderer.d.ts +7 -1
- package/types/scene/Axes.d.ts +0 -1
- package/types/scene/Planet.d.ts +26 -24
- package/types/scene/RenderNode.d.ts +2 -0
- package/types/scene/SkyBox.d.ts +0 -1
- package/types/segment/Segment.d.ts +3 -2
- package/types/segment/SegmentLonLat.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +1 -1
- package/types/utils/NormalMapCreator.d.ts +1 -1
- package/types/utils/VectorTileCreator.d.ts +2 -2
- package/types/utils/shared.d.ts +2 -0
- package/types/webgl/Handler.d.ts +6 -4
|
@@ -1,379 +1,375 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {Vec3|Array.<number>} [options.
|
|
16
|
-
* @param {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
this._positionHigh
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
*
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
this.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.
|
|
150
|
-
|
|
151
|
-
this.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
*
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
*
|
|
248
|
-
* @
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
this.
|
|
257
|
-
|
|
258
|
-
this.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
*
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
this.
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
export { BaseBillboard };
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
4
|
+
import * as utils from "../utils/shared.js";
|
|
5
|
+
import { LOCK_FREE, LOCK_UPDATE } from "./LabelWorker.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Base prototype for billboard and label classes.
|
|
9
|
+
* @class
|
|
10
|
+
* @param {Object} [options] - Options:
|
|
11
|
+
* @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
|
|
12
|
+
* @param {number} [options.rotation] - Screen angle rotaion.
|
|
13
|
+
* @param {Vec4|string|Array.<number>} [options.color] - Billboard color.
|
|
14
|
+
* @param {Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
|
|
15
|
+
* @param {Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
|
|
16
|
+
* @param {boolean} [options.visibility] - Visibility.
|
|
17
|
+
*/
|
|
18
|
+
class BaseBillboard {
|
|
19
|
+
constructor(options) {
|
|
20
|
+
options = options || {};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Object unic identifier.
|
|
24
|
+
* @public
|
|
25
|
+
* @readonly
|
|
26
|
+
* @type {number}
|
|
27
|
+
*/
|
|
28
|
+
this.id = BaseBillboard._staticCounter++;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Billboard center cartesian position.
|
|
32
|
+
* @protected
|
|
33
|
+
* @type {Vec3}
|
|
34
|
+
*/
|
|
35
|
+
this._position = utils.createVector3(options.position);
|
|
36
|
+
|
|
37
|
+
this._positionHigh = new Vec3();
|
|
38
|
+
|
|
39
|
+
this._positionLow = new Vec3();
|
|
40
|
+
|
|
41
|
+
Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Screen space rotation angle.
|
|
45
|
+
* @protected
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
this._rotation = options.rotation || 0;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* RGBA color.
|
|
52
|
+
* @protected
|
|
53
|
+
* @type {Vec4}
|
|
54
|
+
*/
|
|
55
|
+
this._color = utils.createColorRGBA(options.color);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Cartesian aligned axis vector.
|
|
59
|
+
* @protected
|
|
60
|
+
* @type {Vec3}
|
|
61
|
+
*/
|
|
62
|
+
this._alignedAxis = utils.createVector3(options.alignedAxis);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Billboard center screen space offset. Where x,y - screen space offset and z - depth offset.
|
|
66
|
+
* @protected
|
|
67
|
+
* @type {math.Vecto3}
|
|
68
|
+
*/
|
|
69
|
+
this._offset = utils.createVector3(options.offset);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Billboard visibility.
|
|
73
|
+
* @protected
|
|
74
|
+
* @type {boolean}
|
|
75
|
+
*/
|
|
76
|
+
this._visibility = options.visibility != undefined ? options.visibility : true;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Entity instance that holds this billboard.
|
|
80
|
+
* @protected
|
|
81
|
+
* @type {Entity}
|
|
82
|
+
*/
|
|
83
|
+
this._entity = null;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Handler that stores and renders this billboard object.
|
|
87
|
+
* @protected
|
|
88
|
+
* @type {BillboardHandler}
|
|
89
|
+
*/
|
|
90
|
+
this._handler = null;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Billboard handler array index.
|
|
94
|
+
* @protected
|
|
95
|
+
* @type {number}
|
|
96
|
+
*/
|
|
97
|
+
this._handlerIndex = -1;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* An indication that the object is ready to draw
|
|
101
|
+
* @protected
|
|
102
|
+
* @type {number}
|
|
103
|
+
*/
|
|
104
|
+
this._isReady = false;
|
|
105
|
+
|
|
106
|
+
this._lockId = LOCK_FREE;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static get _staticCounter() {
|
|
110
|
+
if (!this._counter && this._counter !== 0) {
|
|
111
|
+
this._counter = 0;
|
|
112
|
+
}
|
|
113
|
+
return this._counter;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static set _staticCounter(n) {
|
|
117
|
+
this._counter = n;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Sets billboard position.
|
|
122
|
+
* @public
|
|
123
|
+
* @param {number} x - X coordinate.
|
|
124
|
+
* @param {number} y - Y coordinate.
|
|
125
|
+
* @param {number} z - Z coordinate.
|
|
126
|
+
*/
|
|
127
|
+
setPosition(x, y, z) {
|
|
128
|
+
this._position.x = x;
|
|
129
|
+
this._position.y = y;
|
|
130
|
+
this._position.z = z;
|
|
131
|
+
Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
|
|
132
|
+
if (this._isReady && this._handler) {
|
|
133
|
+
this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
|
|
134
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
135
|
+
this._lockId = LOCK_UPDATE;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Sets billboard position.
|
|
141
|
+
* @public
|
|
142
|
+
* @param {Vec3} position - Cartesian coordinates.
|
|
143
|
+
*/
|
|
144
|
+
setPosition3v(position) {
|
|
145
|
+
this._position.x = position.x;
|
|
146
|
+
this._position.y = position.y;
|
|
147
|
+
this._position.z = position.z;
|
|
148
|
+
Vec3.doubleToTwoFloats(position, this._positionHigh, this._positionLow);
|
|
149
|
+
if (this._isReady && this._handler) {
|
|
150
|
+
this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
|
|
151
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
152
|
+
this._lockId = LOCK_UPDATE;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Returns billboard position.
|
|
158
|
+
* @public
|
|
159
|
+
* @returns {Vec3}
|
|
160
|
+
*/
|
|
161
|
+
getPosition() {
|
|
162
|
+
return this._position;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Sets screen space offset.
|
|
167
|
+
* @public
|
|
168
|
+
* @param {number} x - X offset.
|
|
169
|
+
* @param {number} y - Y offset.
|
|
170
|
+
* @param {number} [z] - Z offset.
|
|
171
|
+
*/
|
|
172
|
+
setOffset(x, y, z) {
|
|
173
|
+
this._offset.x = x;
|
|
174
|
+
this._offset.y = y;
|
|
175
|
+
z != undefined && (this._offset.z = z);
|
|
176
|
+
if (this._isReady && this._handler) {
|
|
177
|
+
this._handler.setOffsetArr(this._handlerIndex, this._offset);
|
|
178
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
179
|
+
this._lockId = LOCK_UPDATE;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Sets screen space offset.
|
|
185
|
+
* @public
|
|
186
|
+
* @param {Vec2} offset - Offset size.
|
|
187
|
+
*/
|
|
188
|
+
setOffset3v(offset) {
|
|
189
|
+
this.setOffset(offset.x, offset.y, offset.z);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Returns billboard screen space offset size.
|
|
194
|
+
* @public
|
|
195
|
+
* @returns {Vec3}
|
|
196
|
+
*/
|
|
197
|
+
getOffset() {
|
|
198
|
+
return this._offset;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Sets billboard screen space rotation in radians.
|
|
203
|
+
* @public
|
|
204
|
+
* @param {number} rotation - Screen space rotation in radians.
|
|
205
|
+
*/
|
|
206
|
+
setRotation(rotation) {
|
|
207
|
+
if (rotation !== this._rotation) {
|
|
208
|
+
this._rotation = rotation;
|
|
209
|
+
if (this._isReady && this._handler) {
|
|
210
|
+
this._handler.setRotationArr(this._handlerIndex, rotation);
|
|
211
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
212
|
+
this._lockId = LOCK_UPDATE;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Gets screen space rotation.
|
|
219
|
+
* @public
|
|
220
|
+
* @returns {number}
|
|
221
|
+
*/
|
|
222
|
+
getRotation() {
|
|
223
|
+
return this._rotation;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Sets billboard opacity.
|
|
228
|
+
* @public
|
|
229
|
+
* @param {number} a - Billboard opacity.
|
|
230
|
+
*/
|
|
231
|
+
setOpacity(a) {
|
|
232
|
+
if (a !== this._color.w) {
|
|
233
|
+
a != undefined && (this._color.w = a);
|
|
234
|
+
if (this._isReady && this._handler) {
|
|
235
|
+
this._handler.setRgbaArr(this._handlerIndex, this._color);
|
|
236
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
237
|
+
this._lockId = LOCK_UPDATE;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Sets RGBA color. Each channel from 0.0 to 1.0.
|
|
244
|
+
* @public
|
|
245
|
+
* @param {number} r - Red.
|
|
246
|
+
* @param {number} g - Green.
|
|
247
|
+
* @param {number} b - Blue.
|
|
248
|
+
* @param {number} a - Alpha.
|
|
249
|
+
*/
|
|
250
|
+
setColor(r, g, b, a) {
|
|
251
|
+
if (a !== this._color.w || r !== this._color.x || g !== this._color.y || this._color.z !== b) {
|
|
252
|
+
this._color.x = r;
|
|
253
|
+
this._color.y = g;
|
|
254
|
+
this._color.z = b;
|
|
255
|
+
a != undefined && (this._color.w = a);
|
|
256
|
+
if (this._isReady && this._handler) {
|
|
257
|
+
this._handler.setRgbaArr(this._handlerIndex, this._color);
|
|
258
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
259
|
+
this._lockId = LOCK_UPDATE;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Sets RGBA color. Each channel from 0.0 to 1.0.
|
|
266
|
+
* @public
|
|
267
|
+
* @param {Vec4} color - RGBA vector.
|
|
268
|
+
*/
|
|
269
|
+
setColor4v(color) {
|
|
270
|
+
this.setColor(color.x, color.y, color.z, color.w);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Sets billboard color.
|
|
275
|
+
* @public
|
|
276
|
+
* @param {string} color - HTML style color.
|
|
277
|
+
*/
|
|
278
|
+
setColorHTML(color) {
|
|
279
|
+
this.setColor4v(utils.htmlColorToRgba(color));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Returns RGBA color.
|
|
284
|
+
* @public
|
|
285
|
+
* @returns {Vec4}
|
|
286
|
+
*/
|
|
287
|
+
getColor() {
|
|
288
|
+
return this._color;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Sets billboard visibility.
|
|
293
|
+
* @public
|
|
294
|
+
* @param {boolean} visibility - Visibility flag.
|
|
295
|
+
*/
|
|
296
|
+
setVisibility(visibility) {
|
|
297
|
+
if (visibility !== this._visibility) {
|
|
298
|
+
this._visibility = visibility;
|
|
299
|
+
if (this._isReady && this._handler) {
|
|
300
|
+
this._handler.setVisibility(this._handlerIndex, visibility);
|
|
301
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
302
|
+
this._lockId = LOCK_UPDATE;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Returns billboard visibility.
|
|
309
|
+
* @public
|
|
310
|
+
* @returns {boolean}
|
|
311
|
+
*/
|
|
312
|
+
getVisibility() {
|
|
313
|
+
return this._visibility;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Sets billboard cartesian aligned vector.
|
|
318
|
+
* @public
|
|
319
|
+
* @param {number} x - Aligned vector X coordinate.
|
|
320
|
+
* @param {number} y - Aligned vector Y coordinate.
|
|
321
|
+
* @param {number} z - Aligned vector Z coordinate.
|
|
322
|
+
*/
|
|
323
|
+
setAlignedAxis(x, y, z) {
|
|
324
|
+
this._alignedAxis.x = x;
|
|
325
|
+
this._alignedAxis.y = y;
|
|
326
|
+
this._alignedAxis.z = z;
|
|
327
|
+
if (this._isReady && this._handler) {
|
|
328
|
+
this._handler.setAlignedAxisArr(this._handlerIndex, this._alignedAxis);
|
|
329
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
330
|
+
this._lockId = LOCK_UPDATE;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Sets billboard aligned vector.
|
|
336
|
+
* @public
|
|
337
|
+
* @param {math.Vecto3} alignedAxis - Vector to align.
|
|
338
|
+
*/
|
|
339
|
+
setAlignedAxis3v(alignedAxis) {
|
|
340
|
+
this.setAlignedAxis(alignedAxis.x, alignedAxis.y, alignedAxis.z);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Returns aligned vector.
|
|
345
|
+
* @public
|
|
346
|
+
* @returns {Vec3}
|
|
347
|
+
*/
|
|
348
|
+
getAlignedAxis() {
|
|
349
|
+
return this._alignedAxis;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Removes billboard from hander.
|
|
354
|
+
* @public
|
|
355
|
+
*/
|
|
356
|
+
remove() {
|
|
357
|
+
this._entity = null;
|
|
358
|
+
this._handler && this._handler.remove(this);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Sets billboard picking color.
|
|
363
|
+
* @public
|
|
364
|
+
* @param {Vec3} color - Picking color.
|
|
365
|
+
*/
|
|
366
|
+
setPickingColor3v(color) {
|
|
367
|
+
if (this._isReady && this._handler) {
|
|
368
|
+
this._handler.setPickingColorArr(this._handlerIndex, color);
|
|
369
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
370
|
+
this._lockId = LOCK_UPDATE;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export { BaseBillboard };
|