@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.
Files changed (181) hide show
  1. package/README.md +1 -1
  2. package/css/og.css +24 -2
  3. package/dist/@openglobus/og.css +1 -1
  4. package/dist/@openglobus/og.esm.js +2 -2
  5. package/dist/@openglobus/og.esm.js.map +1 -1
  6. package/dist/@openglobus/og.umd.js +2 -2
  7. package/dist/@openglobus/og.umd.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/og/Clock.js +1 -5
  10. package/src/og/Events.js +0 -4
  11. package/src/og/Extent.js +5 -9
  12. package/src/og/Globe.js +92 -55
  13. package/src/og/ImageCanvas.js +12 -5
  14. package/src/og/Lock.js +44 -48
  15. package/src/og/LonLat.js +0 -4
  16. package/src/og/Object3d.js +1 -1
  17. package/src/og/Stack.js +49 -53
  18. package/src/og/astro/earth.js +112 -116
  19. package/src/og/astro/jd.js +514 -518
  20. package/src/og/astro/orbit.js +119 -123
  21. package/src/og/astro/rotation.js +36 -40
  22. package/src/og/bv/Box.js +77 -81
  23. package/src/og/bv/Sphere.js +57 -61
  24. package/src/og/camera/Camera.js +20 -7
  25. package/src/og/camera/PlanetCamera.js +8 -15
  26. package/src/og/control/Atmosphere.js +0 -4
  27. package/src/og/control/Control.js +9 -8
  28. package/src/og/control/DebugInfo.js +0 -4
  29. package/src/og/control/DrawingSwitcher.js +117 -0
  30. package/src/og/control/EarthCoordinates.js +214 -214
  31. package/src/og/control/GeoImageDragControl.js +0 -4
  32. package/src/og/control/KeyboardNavigation.js +0 -4
  33. package/src/og/control/LayerAnimation.js +0 -4
  34. package/src/og/control/LayerSwitcher.js +2 -4
  35. package/src/og/control/Lighting.js +11 -15
  36. package/src/og/control/MouseNavigation.js +0 -4
  37. package/src/og/control/MouseWheelZoomControl.js +0 -4
  38. package/src/og/control/RulerSwitcher.js +0 -4
  39. package/src/og/control/ScaleControl.js +2 -6
  40. package/src/og/control/ShowFps.js +40 -44
  41. package/src/og/control/SimpleNavigation.js +10 -10
  42. package/src/og/control/SimpleSkyBackground.js +0 -4
  43. package/src/og/control/Sun.js +0 -4
  44. package/src/og/control/ToggleWireframe.js +35 -39
  45. package/src/og/control/ZoomControl.js +0 -4
  46. package/src/og/control/drawing/DrawingControl.js +51 -0
  47. package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
  48. package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
  49. package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
  50. package/src/og/control/index.js +5 -1
  51. package/src/og/control/ruler/Ruler.js +0 -4
  52. package/src/og/control/ruler/RulerScene.js +3 -2
  53. package/src/og/control/selection/Selection.js +0 -4
  54. package/src/og/control/selection/SelectionScene.js +2 -4
  55. package/src/og/control/timeline/TimelineControl.js +4 -4
  56. package/src/og/control/timeline/TimelineModel.js +2 -2
  57. package/src/og/control/timeline/TimelineView.js +1 -0
  58. package/src/og/control/visibleExtent/Segment.js +5 -5
  59. package/src/og/control/visibleExtent/drawnode.js +0 -4
  60. package/src/og/ellipsoid/Ellipsoid.js +205 -275
  61. package/src/og/ellipsoid/wgs84.js +0 -4
  62. package/src/og/entity/BaseBillboard.js +375 -379
  63. package/src/og/entity/Billboard.js +0 -4
  64. package/src/og/entity/BillboardHandler.js +0 -4
  65. package/src/og/entity/Entity.js +22 -22
  66. package/src/og/entity/EntityCollection.js +7 -11
  67. package/src/og/entity/GeoObject.js +0 -4
  68. package/src/og/entity/GeoObjectHandler.js +0 -4
  69. package/src/og/entity/Geometry.js +5 -4
  70. package/src/og/entity/GeometryHandler.js +3 -4
  71. package/src/og/entity/Label.js +0 -4
  72. package/src/og/entity/LabelHandler.js +0 -4
  73. package/src/og/entity/PointCloud.js +0 -4
  74. package/src/og/entity/PointCloudHandler.js +122 -126
  75. package/src/og/entity/Polyline.js +4 -6
  76. package/src/og/entity/PolylineHandler.js +104 -108
  77. package/src/og/entity/Ray.js +29 -29
  78. package/src/og/entity/Strip.js +1 -1
  79. package/src/og/index.js +3 -1
  80. package/src/og/input/KeyboardHandler.js +128 -132
  81. package/src/og/input/MouseHandler.js +94 -98
  82. package/src/og/input/TouchHandler.js +59 -63
  83. package/src/og/input/input.js +44 -48
  84. package/src/og/layer/BaseGeoImage.js +5 -8
  85. package/src/og/layer/CanvasTiles.js +0 -4
  86. package/src/og/layer/GeoImage.js +0 -4
  87. package/src/og/layer/GeoTexture2d.js +0 -4
  88. package/src/og/layer/GeoVideo.js +0 -4
  89. package/src/og/layer/KML.js +2 -3
  90. package/src/og/layer/Layer.js +22 -26
  91. package/src/og/layer/Material.js +0 -4
  92. package/src/og/layer/Vector.js +23 -20
  93. package/src/og/layer/WMS.js +182 -186
  94. package/src/og/layer/XYZ.js +0 -4
  95. package/src/og/light/LightSource.js +0 -4
  96. package/src/og/math/Line2.js +28 -32
  97. package/src/og/math/Mat3.js +152 -156
  98. package/src/og/math/Ray.js +0 -4
  99. package/src/og/math/Vec2.js +0 -4
  100. package/src/og/math/Vec3.js +0 -4
  101. package/src/og/math/Vec4.js +0 -4
  102. package/src/og/math/coder.js +104 -104
  103. package/src/og/math.js +39 -7
  104. package/src/og/proj/EPSG3857.js +13 -13
  105. package/src/og/proj/Proj.js +59 -63
  106. package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
  107. package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
  108. package/src/og/quadTree/EntityCollectionNode.js +12 -16
  109. package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
  110. package/src/og/quadTree/QuadTreeStrategy.js +1 -0
  111. package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
  112. package/src/og/renderer/Renderer.js +109 -22
  113. package/src/og/renderer/RendererEvents.js +0 -4
  114. package/src/og/scene/Axes.js +74 -78
  115. package/src/og/scene/BaseNode.js +0 -4
  116. package/src/og/scene/Planet.js +114 -112
  117. package/src/og/scene/RenderNode.js +11 -3
  118. package/src/og/scene/SkyBox.js +104 -108
  119. package/src/og/segment/Segment.js +8 -4
  120. package/src/og/segment/SegmentLonLat.js +2 -6
  121. package/src/og/segment/segmentHelper.js +229 -225
  122. package/src/og/shaders/billboard.js +0 -4
  123. package/src/og/shaders/drawnode.js +5 -9
  124. package/src/og/shaders/geoObject.js +0 -4
  125. package/src/og/shaders/label.js +0 -4
  126. package/src/og/shaders/pickingMask.js +0 -4
  127. package/src/og/shaders/pointCloud.js +0 -4
  128. package/src/og/shaders/polyline.js +0 -4
  129. package/src/og/shaders/ray.js +0 -4
  130. package/src/og/shaders/skybox.js +0 -4
  131. package/src/og/terrain/EmptyTerrain.js +0 -4
  132. package/src/og/utils/FontAtlas.js +0 -4
  133. package/src/og/utils/GeoImageCreator.js +1 -2
  134. package/src/og/utils/NormalMapCreator.js +8 -9
  135. package/src/og/utils/VectorTileCreator.js +3 -9
  136. package/src/og/utils/shared.js +20 -1
  137. package/src/og/webgl/Framebuffer.js +0 -4
  138. package/src/og/webgl/Handler.js +45 -19
  139. package/src/og/webgl/Multisample.js +0 -4
  140. package/src/og/webgl/Program.js +0 -4
  141. package/src/og/webgl/ProgramController.js +2 -2
  142. package/types/Clock.d.ts +1 -1
  143. package/types/Extent.d.ts +5 -5
  144. package/types/Globe.d.ts +15 -1
  145. package/types/ImageCanvas.d.ts +5 -0
  146. package/types/bv/Box.d.ts +1 -1
  147. package/types/bv/Sphere.d.ts +3 -3
  148. package/types/camera/Camera.d.ts +3 -2
  149. package/types/camera/PlanetCamera.d.ts +4 -4
  150. package/types/control/DrawingSwitcher.d.ts +13 -0
  151. package/types/control/EarthCoordinates.d.ts +1 -1
  152. package/types/control/Lighting.d.ts +8 -8
  153. package/types/control/drawing/DrawingControl.d.ts +14 -0
  154. package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
  155. package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
  156. package/types/control/index.d.ts +3 -1
  157. package/types/control/ruler/RulerScene.d.ts +0 -1
  158. package/types/control/selection/SelectionScene.d.ts +0 -1
  159. package/types/ellipsoid/Ellipsoid.d.ts +50 -63
  160. package/types/entity/Entity.d.ts +3 -2
  161. package/types/entity/Geometry.d.ts +5 -0
  162. package/types/entity/Polyline.d.ts +1 -1
  163. package/types/entity/Ray.d.ts +1 -0
  164. package/types/index.d.ts +1 -0
  165. package/types/layer/BaseGeoImage.d.ts +1 -1
  166. package/types/layer/CanvasTiles.d.ts +1 -1
  167. package/types/layer/Layer.d.ts +1 -1
  168. package/types/layer/Vector.d.ts +1 -0
  169. package/types/math.d.ts +7 -0
  170. package/types/renderer/Renderer.d.ts +7 -1
  171. package/types/scene/Axes.d.ts +0 -1
  172. package/types/scene/Planet.d.ts +26 -24
  173. package/types/scene/RenderNode.d.ts +2 -0
  174. package/types/scene/SkyBox.d.ts +0 -1
  175. package/types/segment/Segment.d.ts +3 -2
  176. package/types/segment/SegmentLonLat.d.ts +0 -1
  177. package/types/utils/GeoImageCreator.d.ts +1 -1
  178. package/types/utils/NormalMapCreator.d.ts +1 -1
  179. package/types/utils/VectorTileCreator.d.ts +2 -2
  180. package/types/utils/shared.d.ts +2 -0
  181. package/types/webgl/Handler.d.ts +6 -4
@@ -1,63 +1,59 @@
1
- /**
2
- * @module og/proj/Proj
3
- */
4
-
5
- "use strict";
6
-
7
- /**
8
- * Projection units: 'degrees', 'ft', 'm' or 'km'.
9
- * @enum {string}
10
- * @api
11
- */
12
- export const Units = {
13
- DEGREES: "degrees",
14
- FEET: "ft",
15
- METERS: "m",
16
- KILOMETERS: "km"
17
- };
18
-
19
- /**
20
- * Meters per unit lookup table.
21
- * @const
22
- * @type {Object.<og.proj.Units, number>}
23
- */
24
- export const METERS_PER_UNIT = {};
25
- METERS_PER_UNIT[Units.FEET] = 0.3048;
26
- METERS_PER_UNIT[Units.METERS] = 1;
27
- METERS_PER_UNIT[Units.KILOMETERS] = 1000;
28
-
29
- let _counter = 0;
30
- class Proj {
31
- constructor(options) {
32
- /**
33
- * @public
34
- * @type {string}
35
- */
36
- this.code = options.code;
37
-
38
- /**
39
- * @public
40
- * @type {proj.Units}
41
- */
42
- this.units = /** @type {Units} */ (options.units);
43
-
44
- /**
45
- * Projection identifier, especially usefull for comparison.
46
- * @const
47
- * @type {integer}
48
- */
49
- this.id = _counter++;
50
- }
51
-
52
- /**
53
- * Compare projections.
54
- * @public
55
- * @param {Proj} proj - Projetion object.
56
- * @returns {boolean}
57
- */
58
- equal(proj) {
59
- return proj.id === this.id;
60
- }
61
- }
62
-
63
- export { Proj };
1
+ "use strict";
2
+
3
+ /**
4
+ * Projection units: 'degrees', 'ft', 'm' or 'km'.
5
+ * @enum {string}
6
+ * @api
7
+ */
8
+ export const Units = {
9
+ DEGREES: "degrees",
10
+ FEET: "ft",
11
+ METERS: "m",
12
+ KILOMETERS: "km"
13
+ };
14
+
15
+ /**
16
+ * Meters per unit lookup table.
17
+ * @const
18
+ * @type {Object.<og.proj.Units, number>}
19
+ */
20
+ export const METERS_PER_UNIT = {};
21
+ METERS_PER_UNIT[Units.FEET] = 0.3048;
22
+ METERS_PER_UNIT[Units.METERS] = 1;
23
+ METERS_PER_UNIT[Units.KILOMETERS] = 1000;
24
+
25
+ let _counter = 0;
26
+ class Proj {
27
+ constructor(options) {
28
+ /**
29
+ * @public
30
+ * @type {string}
31
+ */
32
+ this.code = options.code;
33
+
34
+ /**
35
+ * @public
36
+ * @type {proj.Units}
37
+ */
38
+ this.units = /** @type {Units} */ (options.units);
39
+
40
+ /**
41
+ * Projection identifier, especially usefull for comparison.
42
+ * @const
43
+ * @type {integer}
44
+ */
45
+ this.id = _counter++;
46
+ }
47
+
48
+ /**
49
+ * Compare projections.
50
+ * @public
51
+ * @param {Proj} proj - Projetion object.
52
+ * @returns {boolean}
53
+ */
54
+ equal(proj) {
55
+ return proj.id === this.id;
56
+ }
57
+ }
58
+
59
+ export { Proj };
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+
2
3
  import { Extent } from "../Extent.js";
3
4
  import { EPSG4326 } from "../proj/EPSG4326.js";
4
5
  import { Node } from "../quadTree/Node.js";
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+
2
3
  import { Extent } from "../Extent.js";
3
4
  import * as mercator from "../mercator.js";
4
5
  import { Node } from "../quadTree/Node.js";
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/quadTree/EntityCollectionNode
3
- */
4
-
5
1
  'use strict';
6
2
 
7
3
  import { Sphere } from '../bv/Sphere.js';
@@ -75,16 +71,16 @@ class EntityCollectionNode {
75
71
 
76
72
  __setLonLat__(entity) {
77
73
 
78
- if (entity._lonlat.isZero() && !entity._cartesian.isZero()) {
79
- entity._lonlat = this.layer._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
74
+ if (entity._lonLat.isZero() && !entity._cartesian.isZero()) {
75
+ entity._lonLat = this.layer._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
80
76
  }
81
77
 
82
- if (Math.abs(entity._lonlat.lat) < mercator.MAX_LAT) {
83
- entity._lonlatMerc = entity._lonlat.forwardMercator();
78
+ if (Math.abs(entity._lonLat.lat) < mercator.MAX_LAT) {
79
+ entity._lonLatMerc = entity._lonLat.forwardMercator();
84
80
  } else {
85
- entity._lonlatMerc = null;
81
+ entity._lonLatMerc = null;
86
82
  }
87
- return entity._lonlatMerc;
83
+ return entity._lonLatMerc;
88
84
  }
89
85
 
90
86
  buildTree(entities, rightNow) {
@@ -131,8 +127,8 @@ class EntityCollectionNode {
131
127
  }
132
128
 
133
129
  isInside(entity) {
134
- if (entity._lonlatMerc) {
135
- return this.extent.isInside(entity._lonlatMerc);
130
+ if (entity._lonLatMerc) {
131
+ return this.extent.isInside(entity._lonLatMerc);
136
132
  } else {
137
133
  return false;
138
134
  }
@@ -343,10 +339,10 @@ class EntityCollectionNodeWGS84 extends EntityCollectionNode {
343
339
  }
344
340
 
345
341
  __setLonLat__(entity) {
346
- if (entity._lonlat.isZero()) {
347
- entity._lonlat = this.layer._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
342
+ if (entity._lonLat.isZero()) {
343
+ entity._lonLat = this.layer._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
348
344
  }
349
- return entity._lonlat;
345
+ return entity._lonLat;
350
346
  }
351
347
 
352
348
  isVisible() {
@@ -359,7 +355,7 @@ class EntityCollectionNodeWGS84 extends EntityCollectionNode {
359
355
  }
360
356
 
361
357
  isInside(entity) {
362
- return this.extent.isInside(entity._lonlat);
358
+ return this.extent.isInside(entity._lonLat);
363
359
  }
364
360
 
365
361
  /**
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+
2
3
  import { Extent } from "../Extent.js";
3
4
  import { EPSG4326 } from "../proj/EPSG4326.js";
4
5
  import { Node } from "../quadTree/Node.js";
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+
2
3
  import { EPSG3857 } from "../proj/EPSG3857.js";
3
4
 
4
5
  export class QuadTreeStrategy {
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+
2
3
  import { Extent } from "../Extent.js";
3
4
  import { EPSG4326 } from "../proj/EPSG4326.js";
4
5
  import { Node } from "../quadTree/Node.js";
@@ -230,11 +230,24 @@ class Renderer {
230
230
  this.__useDistanceFramebuffer__ = true;
231
231
 
232
232
  if (params.autoActivate || isEmpty(params.autoActivate)) {
233
- this.initialize();
234
233
  this.start();
235
234
  }
236
235
  }
237
236
 
237
+ enableBlendOneSrcAlpha() {
238
+ let gl = this.handler.gl;
239
+ gl.enable(gl.BLEND);
240
+ gl.blendEquation(gl.FUNC_ADD);
241
+ gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
242
+ }
243
+
244
+ enableBlendDefault() {
245
+ let gl = this.handler.gl;
246
+ gl.enable(gl.BLEND);
247
+ gl.blendEquation(gl.FUNC_ADD);
248
+ gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
249
+ }
250
+
238
251
  /**
239
252
  * Sets renderer events activity.
240
253
  * @param {Boolean} activity - Events activity.
@@ -414,17 +427,24 @@ class Renderer {
414
427
  control.remove();
415
428
  }
416
429
 
430
+ isInitialized() {
431
+ return this._initialized;
432
+ }
433
+
417
434
  /**
418
435
  * Renderer initialization.
419
436
  * @public
420
437
  */
421
438
  initialize() {
439
+
422
440
  if (this._initialized) {
423
441
  return;
424
442
  } else {
425
443
  this._initialized = true;
426
444
  }
427
445
 
446
+ this.handler.initialize();
447
+
428
448
  this.billboardsTextureAtlas.assignHandler(this.handler);
429
449
  this.geoObjectsTextureAtlas.assignHandler(this.handler);
430
450
 
@@ -537,17 +557,24 @@ class Renderer {
537
557
 
538
558
  this.screenFramePositionBuffer = this.handler.createArrayBuffer(new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), 2, 4);
539
559
 
540
- let temp = this.controls;
541
- this.controls = {};
542
- for (let i in temp) {
543
- this.addControl(temp[i]);
544
- }
545
560
 
546
561
  this.outputTexture = this.screenTexture.screen;
547
562
 
548
563
  this.fontAtlas.initFont("arial", arial.data, arial.image);
549
564
 
550
565
  this._pickingMaskCoordinatesBuffer = this.handler.createArrayBuffer(new Float32Array([0, 0]), 2, 1);
566
+
567
+ this._initializeRenderNodes();
568
+
569
+ this._initializeControls();
570
+ }
571
+
572
+ _initializeControls() {
573
+ let temp = this.controls;
574
+ this.controls = {};
575
+ for (let i in temp) {
576
+ this.addControl(temp[i]);
577
+ }
551
578
  }
552
579
 
553
580
  resize() {
@@ -616,6 +643,12 @@ class Renderer {
616
643
  }
617
644
  }
618
645
 
646
+ _initializeRenderNodes() {
647
+ for (let i = 0; i < this._renderNodesArr.length; i++) {
648
+ this._renderNodesArr[i].initialize();
649
+ }
650
+ }
651
+
619
652
  /**
620
653
  * Adds render node to the renderer before specific node.
621
654
  * @public
@@ -674,10 +707,8 @@ class Renderer {
674
707
  let ec = this._entityCollections;
675
708
 
676
709
  if (ec.length) {
677
- let gl = this.handler.gl;
678
- gl.enable(gl.BLEND);
679
- gl.blendEquation(gl.FUNC_ADD);
680
- gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
710
+
711
+ this.enableBlendDefault();
681
712
 
682
713
  //geoObject
683
714
  let i = ec.length;
@@ -709,9 +740,7 @@ class Renderer {
709
740
  if (ec.length) {
710
741
  let gl = this.handler.gl;
711
742
 
712
- gl.enable(gl.BLEND);
713
- gl.blendEquation(gl.FUNC_ADD);
714
- gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
743
+ this.enableBlendDefault();
715
744
 
716
745
  // billboards pass
717
746
  gl.activeTexture(gl.TEXTURE0);
@@ -775,10 +804,6 @@ class Renderer {
775
804
 
776
805
  let h = this.handler, gl = h.gl;
777
806
 
778
- gl.enable(gl.BLEND);
779
- gl.blendEquation(gl.FUNC_ADD);
780
- gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
781
-
782
807
  gl.clearColor(0.0, 0.0, 0.0, 1.0);
783
808
  gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
784
809
 
@@ -805,10 +830,7 @@ class Renderer {
805
830
 
806
831
  i = rn.length;
807
832
  while (i--) {
808
- gl.enable(gl.BLEND);
809
- gl.blendEquation(gl.FUNC_ADD);
810
- gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
811
-
833
+ this.enableBlendDefault();
812
834
  rn[i].drawNode();
813
835
  }
814
836
 
@@ -1087,12 +1109,77 @@ class Renderer {
1087
1109
  }
1088
1110
 
1089
1111
  /**
1090
- * Function starts rendering.
1112
+ * Function starts renderer
1091
1113
  * @public
1092
1114
  */
1093
1115
  start() {
1116
+ if (!this._initialized) {
1117
+ this.initialize();
1118
+ }
1094
1119
  this.handler.start();
1095
1120
  }
1121
+
1122
+ destroy() {
1123
+ for (let i in this.controls) {
1124
+ this.controls[i].remove();
1125
+ }
1126
+
1127
+ for (let i = 0; i < this._renderNodesArr.length; i++) {
1128
+ this._renderNodesArr[i].remove();
1129
+ }
1130
+
1131
+ this.div = null;
1132
+
1133
+ this._renderNodesArr = [];
1134
+
1135
+ this.renderNodes = {};
1136
+
1137
+ this.activeCamera = null;
1138
+
1139
+ this.controls = {};
1140
+
1141
+ this.controlsBag = {};
1142
+
1143
+ this.colorObjects = new Map();
1144
+
1145
+ this._pickingCallbacks = [];
1146
+
1147
+ this.pickingFramebuffer = null;
1148
+
1149
+ this._tempPickingPix_ = null;
1150
+
1151
+ this.distanceFramebuffer = null;
1152
+
1153
+ this._distanceCallbacks = [];
1154
+
1155
+ this._tempDistancePix_ = null;
1156
+
1157
+ this._depthCallbacks = [];
1158
+
1159
+ this.depthFramebuffer = null;
1160
+
1161
+ this.sceneFramebuffer = null;
1162
+
1163
+ this.blitFramebuffer = null;
1164
+
1165
+ this.toneMappingFramebuffer = null;
1166
+
1167
+ // todo
1168
+ //this.billboardsTextureAtlas.clear();
1169
+ //this.geoObjectsTextureAtlas.clear()
1170
+ //this.fontAtlas.clear();
1171
+
1172
+ this._entityCollections = [];
1173
+
1174
+ this.colorObjects = null;
1175
+
1176
+ this.handler.destroy();
1177
+
1178
+ this.handler = null;
1179
+
1180
+ this._initialized = false;
1181
+ }
1182
+
1096
1183
  }
1097
1184
 
1098
1185
  export { Renderer };
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/renderer/RendererEvents
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Events } from "../Events.js";
@@ -1,78 +1,74 @@
1
- /**
2
- * @module og/scene/Axes
3
- */
4
-
5
- 'use strict';
6
-
7
- import { Program } from '../webgl/Program.js';
8
- import { RenderNode } from './RenderNode.js';
9
-
10
- class Axes extends RenderNode {
11
- constructor(size) {
12
- super("Axes");
13
-
14
- this.size = size || 100;
15
- this.axesBuffer = null;
16
- this.axesColorBuffer = null;
17
- }
18
-
19
- init() {
20
- this.createAxisBuffer(this.size);
21
- this.drawMode = this.renderer.handler.gl.LINES;
22
- this.renderer.handler.addProgram(new Program("axesShader", {
23
- uniforms: {
24
- projectionViewMatrix: 'mat4'
25
- },
26
- attributes: {
27
- aVertexPosition: 'vec3',
28
- aVertexColor: 'vec4'
29
- },
30
- vertexShader:
31
- `attribute vec3 aVertexPosition;
32
- attribute vec4 aVertexColor;
33
- uniform mat4 projectionViewMatrix;
34
- varying vec4 vColor;
35
- void main(void) {
36
- gl_Position = projectionViewMatrix * vec4(aVertexPosition, 1.0);
37
- vColor = aVertexColor;
38
- }`,
39
- fragmentShader:
40
- `precision highp float;
41
- varying vec4 vColor;
42
- void main(void) {
43
- gl_FragColor = vColor;
44
- }`
45
- }));
46
- }
47
-
48
- frame() {
49
-
50
- this.renderer.handler.programs.axesShader.activate().set({
51
- projectionViewMatrix: this.renderer.activeCamera.getProjectionViewMatrix(),
52
- aVertexPosition: this.axisBuffer,
53
- aVertexColor: this.axisColorBuffer
54
- });
55
-
56
- this.renderer.handler.programs.axesShader.drawArrays(this.drawMode, this.axisBuffer.numItems);
57
- }
58
-
59
- createAxisBuffer(gridSize) {
60
-
61
- var vertices = [
62
- 0.0, 0.0, 0.0, gridSize - 1, 0.0, 0.0, // x - R
63
- 0.0, 0.0, 0.0, 0.0, gridSize - 1, 0.0, // y - B
64
- 0.0, 0.0, 0.0, 0.0, 0.0, gridSize - 1 // z - G
65
- ];
66
-
67
- var colors = [
68
- 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, // x - R
69
- 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, // y - B
70
- 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 // z - G
71
- ];
72
-
73
- this.axisBuffer = this.renderer.handler.createArrayBuffer(new Float32Array(vertices), 3, 6);
74
- this.axisColorBuffer = this.renderer.handler.createArrayBuffer(new Float32Array(colors), 4, 6);
75
- }
76
- }
77
-
78
- export { Axes };
1
+ 'use strict';
2
+
3
+ import { Program } from '../webgl/Program.js';
4
+ import { RenderNode } from './RenderNode.js';
5
+
6
+ class Axes extends RenderNode {
7
+ constructor(size) {
8
+ super("Axes");
9
+
10
+ this.size = size || 100;
11
+ this.axesBuffer = null;
12
+ this.axesColorBuffer = null;
13
+ }
14
+
15
+ init() {
16
+ this.createAxisBuffer(this.size);
17
+ this.drawMode = this.renderer.handler.gl.LINES;
18
+ this.renderer.handler.addProgram(new Program("axesShader", {
19
+ uniforms: {
20
+ projectionViewMatrix: 'mat4'
21
+ },
22
+ attributes: {
23
+ aVertexPosition: 'vec3',
24
+ aVertexColor: 'vec4'
25
+ },
26
+ vertexShader:
27
+ `attribute vec3 aVertexPosition;
28
+ attribute vec4 aVertexColor;
29
+ uniform mat4 projectionViewMatrix;
30
+ varying vec4 vColor;
31
+ void main(void) {
32
+ gl_Position = projectionViewMatrix * vec4(aVertexPosition, 1.0);
33
+ vColor = aVertexColor;
34
+ }`,
35
+ fragmentShader:
36
+ `precision highp float;
37
+ varying vec4 vColor;
38
+ void main(void) {
39
+ gl_FragColor = vColor;
40
+ }`
41
+ }));
42
+ }
43
+
44
+ frame() {
45
+
46
+ this.renderer.handler.programs.axesShader.activate().set({
47
+ projectionViewMatrix: this.renderer.activeCamera.getProjectionViewMatrix(),
48
+ aVertexPosition: this.axisBuffer,
49
+ aVertexColor: this.axisColorBuffer
50
+ });
51
+
52
+ this.renderer.handler.programs.axesShader.drawArrays(this.drawMode, this.axisBuffer.numItems);
53
+ }
54
+
55
+ createAxisBuffer(gridSize) {
56
+
57
+ var vertices = [
58
+ 0.0, 0.0, 0.0, gridSize - 1, 0.0, 0.0, // x - R
59
+ 0.0, 0.0, 0.0, 0.0, gridSize - 1, 0.0, // y - B
60
+ 0.0, 0.0, 0.0, 0.0, 0.0, gridSize - 1 // z - G
61
+ ];
62
+
63
+ var colors = [
64
+ 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, // x - R
65
+ 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, // y - B
66
+ 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 // z - G
67
+ ];
68
+
69
+ this.axisBuffer = this.renderer.handler.createArrayBuffer(new Float32Array(vertices), 3, 6);
70
+ this.axisColorBuffer = this.renderer.handler.createArrayBuffer(new Float32Array(colors), 4, 6);
71
+ }
72
+ }
73
+
74
+ export { Axes };
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/scene/BaseNode
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  /**