@openglobus/og 0.11.5 → 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 (145) hide show
  1. package/package.json +5 -7
  2. package/src/og/Clock.js +6 -10
  3. package/src/og/Events.js +5 -7
  4. package/src/og/Extent.js +73 -32
  5. package/src/og/ImageCanvas.js +18 -15
  6. package/src/og/LonLat.js +13 -10
  7. package/src/og/Popup.js +18 -17
  8. package/src/og/QueueArray.js +3 -4
  9. package/src/og/Rectangle.js +4 -6
  10. package/src/og/Stack.js +2 -4
  11. package/src/og/ajax.js +20 -14
  12. package/src/og/astro/earth.js +21 -15
  13. package/src/og/bv/Box.js +2 -3
  14. package/src/og/bv/Sphere.js +10 -7
  15. package/src/og/camera/Frustum.js +19 -12
  16. package/src/og/camera/PlanetCamera.js +0 -1
  17. package/src/og/control/CompassButton.js +1 -2
  18. package/src/og/control/Control.js +7 -9
  19. package/src/og/control/DebugInfo.js +0 -1
  20. package/src/og/control/KeyboardNavigation.js +9 -9
  21. package/src/og/control/LayerSwitcher.js +21 -20
  22. package/src/og/control/SegmentBoundVisualization.js +5 -6
  23. package/src/og/control/ShowFps.js +12 -7
  24. package/src/og/control/SimpleNavigation.js +5 -7
  25. package/src/og/control/Sun.js +22 -12
  26. package/src/og/control/ToggleWireframe.js +3 -3
  27. package/src/og/control/TouchNavigation.js +43 -32
  28. package/src/og/control/ZoomControl.js +40 -24
  29. package/src/og/ellipsoid/Ellipsoid.js +148 -56
  30. package/src/og/ellipsoid/wgs84.js +3 -3
  31. package/src/og/entity/BaseBillboard.js +65 -14
  32. package/src/og/entity/Billboard.js +9 -5
  33. package/src/og/entity/BillboardHandler.js +310 -64
  34. package/src/og/entity/Entity.js +39 -1
  35. package/src/og/entity/EntityCollection.js +47 -24
  36. package/src/og/entity/GeoObject.js +228 -0
  37. package/src/og/entity/GeoObjectHandler.js +910 -0
  38. package/src/og/entity/GeometryHandler.js +595 -123
  39. package/src/og/entity/Label.js +53 -18
  40. package/src/og/entity/LabelHandler.js +42 -244
  41. package/src/og/entity/LabelWorker.js +213 -0
  42. package/src/og/entity/Object3d.js +504 -0
  43. package/src/og/entity/PointCloud.js +76 -28
  44. package/src/og/entity/PointCloudHandler.js +5 -5
  45. package/src/og/entity/Ray.js +49 -16
  46. package/src/og/entity/Strip.js +72 -43
  47. package/src/og/entity/StripHandler.js +23 -23
  48. package/src/og/layer/BaseGeoImage.js +50 -19
  49. package/src/og/layer/CanvasTiles.js +16 -16
  50. package/src/og/layer/GeoImage.js +6 -6
  51. package/src/og/layer/KML.js +55 -33
  52. package/src/og/layer/Layer.js +3 -3
  53. package/src/og/layer/Vector.js +94 -48
  54. package/src/og/layer/WMS.js +33 -16
  55. package/src/og/light/LightSource.js +19 -12
  56. package/src/og/math/Mat3.js +24 -12
  57. package/src/og/math/Mat4.js +603 -603
  58. package/src/og/math/Plane.js +19 -18
  59. package/src/og/math/Ray.js +17 -12
  60. package/src/og/math/Vec2.js +24 -14
  61. package/src/og/math/Vec3.js +60 -30
  62. package/src/og/math/coder.js +7 -7
  63. package/src/og/proj/EPSG3857.js +3 -3
  64. package/src/og/proj/EPSG4326.js +3 -3
  65. package/src/og/proj/Proj.js +2 -4
  66. package/src/og/quadTree/Node.js +31 -17
  67. package/src/og/renderer/Renderer.js +23 -6
  68. package/src/og/renderer/RendererEvents.js +1 -1
  69. package/src/og/scene/BaseNode.js +2 -3
  70. package/src/og/scene/Planet.js +2 -2
  71. package/src/og/scene/RenderNode.js +15 -8
  72. package/src/og/shaders/geoObject.js +211 -0
  73. package/src/og/shaders/pointCloud.js +41 -41
  74. package/src/og/shaders/shape.js +12 -18
  75. package/src/og/shaders/skybox.js +36 -36
  76. package/src/og/shapes/BaseShape.js +107 -35
  77. package/src/og/shapes/Icosphere.js +25 -10
  78. package/src/og/shapes/Sphere.js +8 -11
  79. package/src/og/utils/TextureAtlas.js +16 -18
  80. package/src/og/utils/shared.js +1 -1
  81. package/src/og/webgl/Handler.js +68 -49
  82. package/src/og/webgl/Multisample.js +44 -16
  83. package/src/og/webgl/Program.js +78 -33
  84. package/src/og/webgl/callbacks.js +3 -3
  85. package/types/Deferred.d.ts +1 -1
  86. package/types/Events.d.ts +2 -2
  87. package/types/Extent.d.ts +1 -1
  88. package/types/Rectangle.d.ts +1 -1
  89. package/types/ajax.d.ts +1 -1
  90. package/types/bv/Box.d.ts +1 -1
  91. package/types/bv/Sphere.d.ts +1 -1
  92. package/types/camera/Camera.d.ts +5 -5
  93. package/types/camera/Frustum.d.ts +6 -6
  94. package/types/camera/PlanetCamera.d.ts +8 -8
  95. package/types/control/Control.d.ts +1 -1
  96. package/types/control/EarthCoordinates.d.ts +1 -1
  97. package/types/control/Sun.d.ts +1 -1
  98. package/types/entity/BaseBillboard.d.ts +15 -8
  99. package/types/entity/Entity.d.ts +24 -9
  100. package/types/entity/EntityCollection.d.ts +15 -9
  101. package/types/entity/GeoObject.d.ts +111 -0
  102. package/types/entity/GeoObjectHandler.d.ts +77 -0
  103. package/types/entity/Geometry.d.ts +1 -1
  104. package/types/entity/GeometryHandler.d.ts +1 -1
  105. package/types/entity/Label.d.ts +3 -3
  106. package/types/entity/LabelHandler.d.ts +2 -0
  107. package/types/entity/LabelWorker.d.ts +9 -0
  108. package/types/entity/PointCloud.d.ts +1 -1
  109. package/types/entity/Polyline.d.ts +5 -5
  110. package/types/entity/Ray.d.ts +1 -1
  111. package/types/entity/Strip.d.ts +1 -1
  112. package/types/layer/BaseGeoImage.d.ts +3 -3
  113. package/types/layer/CanvasTiles.d.ts +5 -5
  114. package/types/layer/GeoImage.d.ts +1 -1
  115. package/types/layer/GeoVideo.d.ts +1 -1
  116. package/types/layer/Layer.d.ts +5 -5
  117. package/types/layer/Vector.d.ts +9 -9
  118. package/types/layer/XYZ.d.ts +3 -3
  119. package/types/light/LightSource.d.ts +7 -7
  120. package/types/math/Plane.d.ts +1 -1
  121. package/types/math/Ray.d.ts +1 -1
  122. package/types/math/Vec2.d.ts +34 -34
  123. package/types/math/Vec3.d.ts +1 -1
  124. package/types/math/Vec4.d.ts +1 -1
  125. package/types/math/coder.d.ts +1 -1
  126. package/types/math.d.ts +1 -1
  127. package/types/proj/Proj.d.ts +2 -2
  128. package/types/quadTree/Node.d.ts +1 -1
  129. package/types/renderer/Renderer.d.ts +12 -10
  130. package/types/renderer/RendererEvents.d.ts +1 -1
  131. package/types/scene/BaseNode.d.ts +4 -4
  132. package/types/scene/Planet.d.ts +40 -40
  133. package/types/scene/RenderNode.d.ts +9 -9
  134. package/types/segment/Segment.d.ts +9 -9
  135. package/types/shaders/geoObject.d.ts +3 -0
  136. package/types/shapes/BaseShape.d.ts +5 -5
  137. package/types/terrain/EmptyTerrain.d.ts +2 -2
  138. package/types/terrain/GlobusTerrain.d.ts +4 -4
  139. package/types/utils/TextureAtlas.d.ts +4 -4
  140. package/types/utils/shared.d.ts +9 -9
  141. package/types/webgl/Framebuffer.d.ts +1 -1
  142. package/types/webgl/Handler.d.ts +16 -7
  143. package/types/webgl/Multisample.d.ts +2 -2
  144. package/types/webgl/Program.d.ts +6 -0
  145. package/types/webgl/ProgramController.d.ts +1 -1
@@ -2,10 +2,10 @@
2
2
  * @module og/entity/BillboardHandler
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import * as shaders from '../shaders/billboard.js';
8
- import { concatTypedArrays, spliceTypedArray } from '../utils/shared.js';
7
+ import * as shaders from "../shaders/billboard.js";
8
+ import { concatTypedArrays, spliceTypedArray } from "../utils/shared.js";
9
9
 
10
10
  const PICKINGCOLOR_BUFFER = 0;
11
11
  const POSITION_BUFFER = 1;
@@ -24,11 +24,10 @@ const ALIGNEDAXIS_BUFFER = 8;
24
24
  */
25
25
  class BillboardHandler {
26
26
  /**
27
- *
28
- * @param {*} entityCollection
27
+ *
28
+ * @param {*} entityCollection
29
29
  */
30
30
  constructor(entityCollection) {
31
-
32
31
  /**
33
32
  * Picking rendering option.
34
33
  * @public
@@ -100,7 +99,6 @@ class BillboardHandler {
100
99
 
101
100
  initProgram() {
102
101
  if (this._renderer.handler) {
103
-
104
102
  if (!this._renderer.handler.programs.billboard) {
105
103
  this._renderer.handler.addProgram(shaders.billboard_screen());
106
104
  }
@@ -128,14 +126,15 @@ class BillboardHandler {
128
126
  while (i--) {
129
127
  var bi = this._billboards[i];
130
128
  bi._handlerIndex = -1;
131
- bi._handler = null;
129
+ bi._handler = null;
130
+ bi._isReady = false;
131
+ bi._lockId = -1;
132
132
  }
133
133
  this._billboards.length = 0;
134
134
  this._billboards = [];
135
135
  }
136
136
 
137
137
  clear() {
138
-
139
138
  this._texCoordArr = null;
140
139
  this._vertexArr = null;
141
140
  this._positionHighArr = null;
@@ -203,7 +202,8 @@ class BillboardHandler {
203
202
  }
204
203
 
205
204
  add(billboard) {
206
- if (billboard._handlerIndex == -1) {
205
+ if (billboard._handlerIndex == -1) {
206
+ billboard._isReady = true;
207
207
  billboard._handler = this;
208
208
  billboard._handlerIndex = this._billboards.length;
209
209
  this._billboards.push(billboard);
@@ -215,36 +215,180 @@ class BillboardHandler {
215
215
 
216
216
  _addBillboardToArrays(billboard) {
217
217
  if (billboard._visibility) {
218
- this._vertexArr = concatTypedArrays(this._vertexArr, [-0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5]);
218
+ this._vertexArr = concatTypedArrays(
219
+ this._vertexArr,
220
+ [-0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5]
221
+ );
219
222
  } else {
220
- this._vertexArr = concatTypedArrays(this._vertexArr, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
223
+ this._vertexArr = concatTypedArrays(
224
+ this._vertexArr,
225
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
226
+ );
221
227
  }
222
228
 
223
- this._texCoordArr = concatTypedArrays(this._texCoordArr, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
224
-
225
- var x = billboard._positionHigh.x, y = billboard._positionHigh.y, z = billboard._positionHigh.z, w;
226
- this._positionHighArr = concatTypedArrays(this._positionHighArr, [x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y, z]);
227
-
228
- x = billboard._positionLow.x; y = billboard._positionLow.y; z = billboard._positionLow.z;
229
- this._positionLowArr = concatTypedArrays(this._positionLowArr, [x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y, z]);
230
-
231
- x = billboard._width; y = billboard._height;
229
+ this._texCoordArr = concatTypedArrays(
230
+ this._texCoordArr,
231
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
232
+ );
233
+
234
+ var x = billboard._positionHigh.x,
235
+ y = billboard._positionHigh.y,
236
+ z = billboard._positionHigh.z,
237
+ w;
238
+ this._positionHighArr = concatTypedArrays(this._positionHighArr, [
239
+ x,
240
+ y,
241
+ z,
242
+ x,
243
+ y,
244
+ z,
245
+ x,
246
+ y,
247
+ z,
248
+ x,
249
+ y,
250
+ z,
251
+ x,
252
+ y,
253
+ z,
254
+ x,
255
+ y,
256
+ z
257
+ ]);
258
+
259
+ x = billboard._positionLow.x;
260
+ y = billboard._positionLow.y;
261
+ z = billboard._positionLow.z;
262
+ this._positionLowArr = concatTypedArrays(this._positionLowArr, [
263
+ x,
264
+ y,
265
+ z,
266
+ x,
267
+ y,
268
+ z,
269
+ x,
270
+ y,
271
+ z,
272
+ x,
273
+ y,
274
+ z,
275
+ x,
276
+ y,
277
+ z,
278
+ x,
279
+ y,
280
+ z
281
+ ]);
282
+
283
+ x = billboard._width;
284
+ y = billboard._height;
232
285
  this._sizeArr = concatTypedArrays(this._sizeArr, [x, y, x, y, x, y, x, y, x, y, x, y]);
233
286
 
234
- x = billboard._offset.x; y = billboard._offset.y; z = billboard._offset.z;
235
- this._offsetArr = concatTypedArrays(this._offsetArr, [x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y, z]);
236
-
237
- x = billboard._color.x; y = billboard._color.y; z = billboard._color.z; w = billboard._color.w;
238
- this._rgbaArr = concatTypedArrays(this._rgbaArr, [x, y, z, w, x, y, z, w, x, y, z, w, x, y, z, w, x, y, z, w, x, y, z, w]);
287
+ x = billboard._offset.x;
288
+ y = billboard._offset.y;
289
+ z = billboard._offset.z;
290
+ this._offsetArr = concatTypedArrays(this._offsetArr, [
291
+ x,
292
+ y,
293
+ z,
294
+ x,
295
+ y,
296
+ z,
297
+ x,
298
+ y,
299
+ z,
300
+ x,
301
+ y,
302
+ z,
303
+ x,
304
+ y,
305
+ z,
306
+ x,
307
+ y,
308
+ z
309
+ ]);
310
+
311
+ x = billboard._color.x;
312
+ y = billboard._color.y;
313
+ z = billboard._color.z;
314
+ w = billboard._color.w;
315
+ this._rgbaArr = concatTypedArrays(this._rgbaArr, [
316
+ x,
317
+ y,
318
+ z,
319
+ w,
320
+ x,
321
+ y,
322
+ z,
323
+ w,
324
+ x,
325
+ y,
326
+ z,
327
+ w,
328
+ x,
329
+ y,
330
+ z,
331
+ w,
332
+ x,
333
+ y,
334
+ z,
335
+ w,
336
+ x,
337
+ y,
338
+ z,
339
+ w
340
+ ]);
239
341
 
240
342
  x = billboard._rotation;
241
343
  this._rotationArr = concatTypedArrays(this._rotationArr, [x, x, x, x, x, x]);
242
344
 
243
- x = billboard._alignedAxis.x; y = billboard._alignedAxis.y; z = billboard._alignedAxis.z;
244
- this._alignedAxisArr = concatTypedArrays(this._alignedAxisArr, [x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y, z]);
245
-
246
- x = billboard._entity._pickingColor.x / 255; y = billboard._entity._pickingColor.y / 255; z = billboard._entity._pickingColor.z / 255;
247
- this._pickingColorArr = concatTypedArrays(this._pickingColorArr, [x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y, z]);
345
+ x = billboard._alignedAxis.x;
346
+ y = billboard._alignedAxis.y;
347
+ z = billboard._alignedAxis.z;
348
+ this._alignedAxisArr = concatTypedArrays(this._alignedAxisArr, [
349
+ x,
350
+ y,
351
+ z,
352
+ x,
353
+ y,
354
+ z,
355
+ x,
356
+ y,
357
+ z,
358
+ x,
359
+ y,
360
+ z,
361
+ x,
362
+ y,
363
+ z,
364
+ x,
365
+ y,
366
+ z
367
+ ]);
368
+
369
+ x = billboard._entity._pickingColor.x / 255;
370
+ y = billboard._entity._pickingColor.y / 255;
371
+ z = billboard._entity._pickingColor.z / 255;
372
+ this._pickingColorArr = concatTypedArrays(this._pickingColorArr, [
373
+ x,
374
+ y,
375
+ z,
376
+ x,
377
+ y,
378
+ z,
379
+ x,
380
+ y,
381
+ z,
382
+ x,
383
+ y,
384
+ z,
385
+ x,
386
+ y,
387
+ z,
388
+ x,
389
+ y,
390
+ z
391
+ ]);
248
392
  }
249
393
 
250
394
  _displayPASS() {
@@ -272,19 +416,43 @@ class BillboardHandler {
272
416
 
273
417
  gl.uniform1f(shu.uOpacity, ec._fadingOpacity);
274
418
 
275
- gl.uniform2fv(shu.uFloatParams, [ec.renderNode._planetRadius2 || 0, r.activeCamera._tanViewAngle_hradOneByHeight]);
419
+ gl.uniform2fv(shu.uFloatParams, [
420
+ ec.renderNode._planetRadius2 || 0,
421
+ r.activeCamera._tanViewAngle_hradOneByHeight
422
+ ]);
276
423
 
277
424
  gl.bindBuffer(gl.ARRAY_BUFFER, this._texCoordBuffer);
278
- gl.vertexAttribPointer(sha.a_texCoord, this._texCoordBuffer.itemSize, gl.FLOAT, false, 0, 0);
425
+ gl.vertexAttribPointer(
426
+ sha.a_texCoord,
427
+ this._texCoordBuffer.itemSize,
428
+ gl.FLOAT,
429
+ false,
430
+ 0,
431
+ 0
432
+ );
279
433
 
280
434
  gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
281
435
  gl.vertexAttribPointer(sha.a_vertices, this._vertexBuffer.itemSize, gl.FLOAT, false, 0, 0);
282
436
 
283
437
  gl.bindBuffer(gl.ARRAY_BUFFER, this._positionHighBuffer);
284
- gl.vertexAttribPointer(sha.a_positionsHigh, this._positionHighBuffer.itemSize, gl.FLOAT, false, 0, 0);
438
+ gl.vertexAttribPointer(
439
+ sha.a_positionsHigh,
440
+ this._positionHighBuffer.itemSize,
441
+ gl.FLOAT,
442
+ false,
443
+ 0,
444
+ 0
445
+ );
285
446
 
286
447
  gl.bindBuffer(gl.ARRAY_BUFFER, this._positionLowBuffer);
287
- gl.vertexAttribPointer(sha.a_positionsLow, this._positionLowBuffer.itemSize, gl.FLOAT, false, 0, 0);
448
+ gl.vertexAttribPointer(
449
+ sha.a_positionsLow,
450
+ this._positionLowBuffer.itemSize,
451
+ gl.FLOAT,
452
+ false,
453
+ 0,
454
+ 0
455
+ );
288
456
 
289
457
  gl.bindBuffer(gl.ARRAY_BUFFER, this._rgbaBuffer);
290
458
  gl.vertexAttribPointer(sha.a_rgba, this._rgbaBuffer.itemSize, gl.FLOAT, false, 0, 0);
@@ -296,10 +464,24 @@ class BillboardHandler {
296
464
  gl.vertexAttribPointer(sha.a_offset, this._offsetBuffer.itemSize, gl.FLOAT, false, 0, 0);
297
465
 
298
466
  gl.bindBuffer(gl.ARRAY_BUFFER, this._rotationBuffer);
299
- gl.vertexAttribPointer(sha.a_rotation, this._rotationBuffer.itemSize, gl.FLOAT, false, 0, 0);
467
+ gl.vertexAttribPointer(
468
+ sha.a_rotation,
469
+ this._rotationBuffer.itemSize,
470
+ gl.FLOAT,
471
+ false,
472
+ 0,
473
+ 0
474
+ );
300
475
 
301
476
  gl.bindBuffer(gl.ARRAY_BUFFER, this._alignedAxisBuffer);
302
- gl.vertexAttribPointer(sha.a_alignedAxis, this._alignedAxisBuffer.itemSize, gl.FLOAT, false, 0, 0);
477
+ gl.vertexAttribPointer(
478
+ sha.a_alignedAxis,
479
+ this._alignedAxisBuffer.itemSize,
480
+ gl.FLOAT,
481
+ false,
482
+ 0,
483
+ 0
484
+ );
303
485
 
304
486
  gl.drawArrays(gl.TRIANGLES, 0, this._vertexBuffer.numItems);
305
487
  }
@@ -329,19 +511,43 @@ class BillboardHandler {
329
511
 
330
512
  gl.uniform1f(shu.pickingScale, ec.pickingScale);
331
513
 
332
- gl.uniform2fv(shu.uFloatParams, [ec.renderNode._planetRadius2 || 0, r.activeCamera._tanViewAngle_hradOneByHeight]);
514
+ gl.uniform2fv(shu.uFloatParams, [
515
+ ec.renderNode._planetRadius2 || 0,
516
+ r.activeCamera._tanViewAngle_hradOneByHeight
517
+ ]);
333
518
 
334
519
  gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
335
520
  gl.vertexAttribPointer(sha.a_vertices, this._vertexBuffer.itemSize, gl.FLOAT, false, 0, 0);
336
521
 
337
522
  gl.bindBuffer(gl.ARRAY_BUFFER, this._positionHighBuffer);
338
- gl.vertexAttribPointer(sha.a_positionsHigh, this._positionHighBuffer.itemSize, gl.FLOAT, false, 0, 0);
523
+ gl.vertexAttribPointer(
524
+ sha.a_positionsHigh,
525
+ this._positionHighBuffer.itemSize,
526
+ gl.FLOAT,
527
+ false,
528
+ 0,
529
+ 0
530
+ );
339
531
 
340
532
  gl.bindBuffer(gl.ARRAY_BUFFER, this._positionLowBuffer);
341
- gl.vertexAttribPointer(sha.a_positionsLow, this._positionLowBuffer.itemSize, gl.FLOAT, false, 0, 0);
533
+ gl.vertexAttribPointer(
534
+ sha.a_positionsLow,
535
+ this._positionLowBuffer.itemSize,
536
+ gl.FLOAT,
537
+ false,
538
+ 0,
539
+ 0
540
+ );
342
541
 
343
542
  gl.bindBuffer(gl.ARRAY_BUFFER, this._pickingColorBuffer);
344
- gl.vertexAttribPointer(sha.a_pickingColor, this._pickingColorBuffer.itemSize, gl.FLOAT, false, 0, 0);
543
+ gl.vertexAttribPointer(
544
+ sha.a_pickingColor,
545
+ this._pickingColorBuffer.itemSize,
546
+ gl.FLOAT,
547
+ false,
548
+ 0,
549
+ 0
550
+ );
345
551
 
346
552
  gl.bindBuffer(gl.ARRAY_BUFFER, this._sizeBuffer);
347
553
  gl.vertexAttribPointer(sha.a_size, this._sizeBuffer.itemSize, gl.FLOAT, false, 0, 0);
@@ -350,10 +556,24 @@ class BillboardHandler {
350
556
  gl.vertexAttribPointer(sha.a_offset, this._offsetBuffer.itemSize, gl.FLOAT, false, 0, 0);
351
557
 
352
558
  gl.bindBuffer(gl.ARRAY_BUFFER, this._rotationBuffer);
353
- gl.vertexAttribPointer(sha.a_rotation, this._rotationBuffer.itemSize, gl.FLOAT, false, 0, 0);
559
+ gl.vertexAttribPointer(
560
+ sha.a_rotation,
561
+ this._rotationBuffer.itemSize,
562
+ gl.FLOAT,
563
+ false,
564
+ 0,
565
+ 0
566
+ );
354
567
 
355
568
  gl.bindBuffer(gl.ARRAY_BUFFER, this._alignedAxisBuffer);
356
- gl.vertexAttribPointer(sha.a_alignedAxis, this._alignedAxisBuffer.itemSize, gl.FLOAT, false, 0, 0);
569
+ gl.vertexAttribPointer(
570
+ sha.a_alignedAxis,
571
+ this._alignedAxisBuffer.itemSize,
572
+ gl.FLOAT,
573
+ false,
574
+ 0,
575
+ 0
576
+ );
357
577
 
358
578
  gl.drawArrays(gl.TRIANGLES, 0, this._vertexBuffer.numItems);
359
579
  }
@@ -405,21 +625,25 @@ class BillboardHandler {
405
625
  this.refresh();
406
626
 
407
627
  billboard._handlerIndex = -1;
408
- billboard._handler = null;
628
+ billboard._handler = null;
629
+ billboard._isReady = false;
630
+ billboard._lockId = -1;
409
631
  }
410
632
 
411
633
  remove(billboard) {
412
- if (billboard._handler && this.__staticId == billboard._handler.__staticId) {
634
+ if (billboard._isReady && this.__staticId == billboard._handler.__staticId) {
413
635
  this._removeBillboard(billboard);
414
636
  }
415
637
  }
416
638
 
417
639
  setPositionArr(index, positionHigh, positionLow) {
418
-
419
640
  var i = index * 18;
420
641
 
421
642
  // High
422
- var a = this._positionHighArr, x = positionHigh.x, y = positionHigh.y, z = positionHigh.z;
643
+ var a = this._positionHighArr,
644
+ x = positionHigh.x,
645
+ y = positionHigh.y,
646
+ z = positionHigh.z;
423
647
 
424
648
  a[i] = x;
425
649
  a[i + 1] = y;
@@ -446,7 +670,10 @@ class BillboardHandler {
446
670
  a[i + 17] = z;
447
671
 
448
672
  // Low
449
- a = this._positionLowArr; x = positionLow.x; y = positionLow.y; z = positionLow.z;
673
+ a = this._positionLowArr;
674
+ x = positionLow.x;
675
+ y = positionLow.y;
676
+ z = positionLow.z;
450
677
 
451
678
  a[i] = x;
452
679
  a[i + 1] = y;
@@ -476,9 +703,11 @@ class BillboardHandler {
476
703
  }
477
704
 
478
705
  setPickingColorArr(index, color) {
479
-
480
706
  var i = index * 18;
481
- var a = this._pickingColorArr, x = color.x / 255, y = color.y / 255, z = color.z / 255;
707
+ var a = this._pickingColorArr,
708
+ x = color.x / 255,
709
+ y = color.y / 255,
710
+ z = color.z / 255;
482
711
 
483
712
  a[i] = x;
484
713
  a[i + 1] = y;
@@ -508,9 +737,10 @@ class BillboardHandler {
508
737
  }
509
738
 
510
739
  setSizeArr(index, width, height) {
511
-
512
740
  var i = index * 12;
513
- var a = this._sizeArr, x = width, y = height;
741
+ var a = this._sizeArr,
742
+ x = width,
743
+ y = height;
514
744
 
515
745
  a[i] = x;
516
746
  a[i + 1] = y;
@@ -534,9 +764,11 @@ class BillboardHandler {
534
764
  }
535
765
 
536
766
  setOffsetArr(index, offset) {
537
-
538
767
  var i = index * 18;
539
- var a = this._offsetArr, x = offset.x, y = offset.y, z = offset.z;
768
+ var a = this._offsetArr,
769
+ x = offset.x,
770
+ y = offset.y,
771
+ z = offset.z;
540
772
 
541
773
  a[i] = x;
542
774
  a[i + 1] = y;
@@ -566,9 +798,12 @@ class BillboardHandler {
566
798
  }
567
799
 
568
800
  setRgbaArr(index, rgba) {
569
-
570
801
  var i = index * 24;
571
- var a = this._rgbaArr, x = rgba.x, y = rgba.y, z = rgba.z, w = rgba.w;
802
+ var a = this._rgbaArr,
803
+ x = rgba.x,
804
+ y = rgba.y,
805
+ z = rgba.z,
806
+ w = rgba.w;
572
807
 
573
808
  a[i] = x;
574
809
  a[i + 1] = y;
@@ -604,7 +839,6 @@ class BillboardHandler {
604
839
  }
605
840
 
606
841
  setRotationArr(index, rotation) {
607
-
608
842
  var i = index * 6;
609
843
  var a = this._rotationArr;
610
844
 
@@ -619,7 +853,6 @@ class BillboardHandler {
619
853
  }
620
854
 
621
855
  setTexCoordArr(index, tcoordArr) {
622
-
623
856
  var i = index * 12;
624
857
  var a = this._texCoordArr;
625
858
 
@@ -655,7 +888,6 @@ class BillboardHandler {
655
888
  }
656
889
 
657
890
  setVertexArr(index, vertexArr) {
658
-
659
891
  var i = index * 12;
660
892
  var a = this._vertexArr;
661
893
 
@@ -679,9 +911,11 @@ class BillboardHandler {
679
911
  }
680
912
 
681
913
  setAlignedAxisArr(index, alignedAxis) {
682
-
683
914
  var i = index * 18;
684
- var a = this._alignedAxisArr, x = alignedAxis.x, y = alignedAxis.y, z = alignedAxis.z;
915
+ var a = this._alignedAxisArr,
916
+ x = alignedAxis.x,
917
+ y = alignedAxis.y,
918
+ z = alignedAxis.z;
685
919
 
686
920
  a[i] = x;
687
921
  a[i + 1] = y;
@@ -763,19 +997,31 @@ class BillboardHandler {
763
997
  createTexCoordBuffer() {
764
998
  var h = this._renderer.handler;
765
999
  h.gl.deleteBuffer(this._texCoordBuffer);
766
- this._texCoordBuffer = h.createArrayBuffer(this._texCoordArr, 2, this._texCoordArr.length / 2);
1000
+ this._texCoordBuffer = h.createArrayBuffer(
1001
+ this._texCoordArr,
1002
+ 2,
1003
+ this._texCoordArr.length / 2
1004
+ );
767
1005
  }
768
1006
 
769
1007
  createAlignedAxisBuffer() {
770
1008
  var h = this._renderer.handler;
771
1009
  h.gl.deleteBuffer(this._alignedAxisBuffer);
772
- this._alignedAxisBuffer = h.createArrayBuffer(this._alignedAxisArr, 3, this._alignedAxisArr.length / 3);
1010
+ this._alignedAxisBuffer = h.createArrayBuffer(
1011
+ this._alignedAxisArr,
1012
+ 3,
1013
+ this._alignedAxisArr.length / 3
1014
+ );
773
1015
  }
774
1016
 
775
1017
  createPickingColorBuffer() {
776
1018
  var h = this._renderer.handler;
777
1019
  h.gl.deleteBuffer(this._pickingColorBuffer);
778
- this._pickingColorBuffer = h.createArrayBuffer(this._pickingColorArr, 3, this._pickingColorArr.length / 3);
1020
+ this._pickingColorBuffer = h.createArrayBuffer(
1021
+ this._pickingColorArr,
1022
+ 3,
1023
+ this._pickingColorArr.length / 3
1024
+ );
779
1025
  }
780
1026
 
781
1027
  refreshTexCoordsArr() {
@@ -17,6 +17,7 @@ import { Ray } from "./Ray.js";
17
17
  import { PointCloud } from "./PointCloud.js";
18
18
  import { Sphere } from "../shapes/Sphere.js";
19
19
  import { Vec3 } from "../math/Vec3.js";
20
+ import { GeoObject } from "./GeoObject.js";
20
21
 
21
22
  /**
22
23
  * Entity instances aggregate multiple forms of visualization into a single high-level object.
@@ -158,6 +159,7 @@ class Entity {
158
159
  polyline: [Polyline, this.setPolyline],
159
160
  pointCloud: [PointCloud, this.setPointCloud],
160
161
  geometry: [Geometry, this.setGeometry],
162
+ geoObject: [GeoObject, this.setGeoObject],
161
163
  strip: [Strip, this.setStrip],
162
164
  ray: [Ray, this.setRay]
163
165
  };
@@ -211,6 +213,13 @@ class Entity {
211
213
  */
212
214
  this.geometry = this._createOptionFeature("geometry", options.geometry);
213
215
 
216
+ /**
217
+ * Geo object entity
218
+ * @public
219
+ * @type {og.Geometry}
220
+ */
221
+ this.geoObject = this._createOptionFeature("geoObject", options.geoObject);
222
+
214
223
  /**
215
224
  * Strip entity.
216
225
  * @public
@@ -249,7 +258,7 @@ class Entity {
249
258
  /**
250
259
  * Adds current entity into the specified entity collection.
251
260
  * @public
252
- * @param {EntityCollection|og.layer.Vector} collection - Specified entity collection or vector layer.
261
+ * @param {EntityCollection|Vector} collection - Specified entity collection or vector layer.
253
262
  * @param {Boolean} [rightNow=false] - Entity insertion option for vector layer.
254
263
  * @returns {Entity} - This object.
255
264
  */
@@ -278,6 +287,9 @@ class Entity {
278
287
  // billboards
279
288
  this.billboard && this.billboard.setVisibility(visibility);
280
289
 
290
+ // billboards
291
+ this.geoObject && this.geoObject.setVisibility(visibility);
292
+
281
293
  // labels
282
294
  this.label && this.label.setVisibility(visibility);
283
295
 
@@ -333,6 +345,9 @@ class Entity {
333
345
  // billboards
334
346
  this.billboard && this.billboard.setPosition3v(p);
335
347
 
348
+ // geoObject
349
+ this.geoObject && this.geoObject.setPosition3v(p);
350
+
336
351
  // labels
337
352
  this.label && this.label.setPosition3v(p);
338
353
 
@@ -374,6 +389,9 @@ class Entity {
374
389
  // billboards
375
390
  this.billboard && this.billboard.setPosition3v(p);
376
391
 
392
+ // geoObject
393
+ this.geoObject && this.geoObject.setPosition3v(p);
394
+
377
395
  // labels
378
396
  this.label && this.label.setPosition3v(p);
379
397
 
@@ -580,6 +598,24 @@ class Entity {
580
598
  return geometry;
581
599
  }
582
600
 
601
+ /**
602
+ * Sets entity geoObject.
603
+ * @public
604
+ * @param {GeoObject} geoObject - GeoObject.
605
+ * @returns {GeoObject} -
606
+ */
607
+ setGeoObject(geoObject) {
608
+ if (this.geoObject) {
609
+ this.geoObject.remove();
610
+ }
611
+ this.geoObject = geoObject;
612
+ this.geoObject._entity = this;
613
+ this.geoObject.setPosition3v(this._cartesian);
614
+ this.geoObject.setVisibility(this._visibility);
615
+ this._entityCollection && this._entityCollection._geoObjectHandler.add(geoObject);
616
+ return geoObject;
617
+ }
618
+
583
619
  /**
584
620
  * Sets entity strip.
585
621
  * @public
@@ -648,6 +684,8 @@ class Entity {
648
684
  // strip
649
685
  this.strip && this.strip.setPickingColor3v(c);
650
686
 
687
+ // billboard
688
+ this.geoObject && this.geoObject.setPickingColor3v(c);
651
689
  for (var i = 0; i < this.childrenNodes.length; i++) {
652
690
  this.childrenNodes[i].setPickingColor();
653
691
  }