@openglobus/og 0.13.4 → 0.13.7

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 (55) hide show
  1. package/css/og.css +66 -25
  2. package/dist/@openglobus/og.css +1 -1
  3. package/dist/@openglobus/og.esm.js +2 -2
  4. package/dist/@openglobus/og.esm.js.map +1 -1
  5. package/dist/@openglobus/og.umd.js +2 -2
  6. package/dist/@openglobus/og.umd.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/og/Events.js +188 -188
  9. package/src/og/Extent.js +1 -9
  10. package/src/og/Globe.js +1 -0
  11. package/src/og/control/DebugInfo.js +15 -4
  12. package/src/og/control/EarthCoordinates.js +151 -160
  13. package/src/og/control/KeyboardNavigation.js +48 -2
  14. package/src/og/control/TouchNavigation.js +13 -13
  15. package/src/og/control/ZoomControl.js +1 -1
  16. package/src/og/ellipsoid/Ellipsoid.js +1 -1
  17. package/src/og/entity/Billboard.js +165 -165
  18. package/src/og/entity/BillboardHandler.js +1 -1
  19. package/src/og/entity/Geometry.js +319 -319
  20. package/src/og/entity/Label.js +348 -346
  21. package/src/og/entity/LabelHandler.js +44 -37
  22. package/src/og/input/input.js +7 -1
  23. package/src/og/layer/CanvasTiles.js +8 -8
  24. package/src/og/layer/KML.js +181 -12
  25. package/src/og/layer/Layer.js +4 -2
  26. package/src/og/layer/XYZ.js +4 -2
  27. package/src/og/quadTree/Node.js +1 -0
  28. package/src/og/renderer/RendererEvents.js +17 -3
  29. package/src/og/scene/Planet.js +89 -30
  30. package/src/og/segment/Segment.js +1 -0
  31. package/src/og/shaders/label.js +56 -13
  32. package/src/og/terrain/EmptyTerrain.js +164 -146
  33. package/src/og/terrain/Geoid.js +246 -241
  34. package/src/og/terrain/GlobusTerrain.js +23 -24
  35. package/src/og/terrain/MapboxTerrain.js +292 -294
  36. package/src/og/utils/FontAtlas.js +25 -15
  37. package/src/og/utils/Loader.js +53 -12
  38. package/src/og/utils/PlainSegmentWorker.js +38 -26
  39. package/src/og/utils/TextureAtlas.js +291 -280
  40. package/src/og/utils/units.js +78 -0
  41. package/types/control/EarthCoordinates.d.ts +27 -30
  42. package/types/control/KeyboardNavigation.d.ts +3 -0
  43. package/types/entity/Label.d.ts +1 -0
  44. package/types/entity/LabelHandler.d.ts +1 -1
  45. package/types/input/input.d.ts +6 -0
  46. package/types/layer/KML.d.ts +26 -1
  47. package/types/renderer/RendererEvents.d.ts +2 -0
  48. package/types/scene/Planet.d.ts +10 -1
  49. package/types/terrain/EmptyTerrain.d.ts +4 -1
  50. package/types/terrain/Geoid.d.ts +1 -10
  51. package/types/terrain/GlobusTerrain.d.ts +0 -2
  52. package/types/terrain/MapboxTerrain.d.ts +1 -1
  53. package/types/utils/Loader.d.ts +3 -0
  54. package/types/utils/TextureAtlas.d.ts +2 -0
  55. package/types/utils/units.d.ts +20 -0
@@ -1,165 +1,165 @@
1
- /**
2
- * @module og/entity/Billboard
3
- */
4
-
5
- "use strict";
6
-
7
- import { BaseBillboard } from "./BaseBillboard.js";
8
-
9
- /**
10
- * Represents basic quad billboard image.
11
- * @class
12
- * @extends {BaseBillboard}
13
- * @param {Object} [options] - Options:
14
- * @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
15
- * @param {number} [options.rotation] - Screen angle rotaion.
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
- * @param {boolean} [options.visibility] - Visibility.
20
- * @param {string} [options.src] - Billboard image url source.
21
- * @param {Image} [options.image] - Billboard image object.
22
- * @param {number} [options.width] - Screen width.
23
- * @param {number} [options.height] - Screen height.
24
- * @param {number} [options.scale] - Billboard scale.
25
- */
26
- class Billboard extends BaseBillboard {
27
- constructor(options) {
28
- super(options);
29
-
30
- options = options || {};
31
-
32
- /**
33
- * Image src.
34
- * @protected
35
- * @type {string}
36
- */
37
- this._src = options.src || null;
38
-
39
- /**
40
- * Image object.
41
- * @protected
42
- * @type {Object}
43
- */
44
- this._image = options.image || null;
45
-
46
- this._scale = 1.0;
47
-
48
- /**
49
- * Billboard screen width.
50
- * @protected
51
- * @type {number}
52
- */
53
- this._width = options.width || (options.size ? options.size[0] : 30);
54
-
55
- /**
56
- * Billboard screen height.
57
- * @protected
58
- * @type {number}
59
- */
60
- this._height = options.height || (options.size ? options.size[1] : 30);
61
- }
62
-
63
- /**
64
- * Sets billboard image url source.
65
- * @public
66
- * @param {string} src - Image url.
67
- */
68
- setSrc(src) {
69
- this._src = src;
70
- var bh = this._handler;
71
- if (bh && src) {
72
- var rn = bh._entityCollection.renderNode;
73
- if (rn) {
74
- var ta = rn.renderer.billboardsTextureAtlas;
75
- var that = this;
76
- ta.loadImage(src, function (img) {
77
- if (ta.nodes[img.__nodeIndex]) {
78
- that._image = img;
79
- bh.setTexCoordArr(
80
- that._handlerIndex,
81
- ta.nodes[that._image.__nodeIndex].texCoords
82
- );
83
- } else {
84
- ta.addImage(img);
85
- ta.createTexture();
86
- that._image = img;
87
- rn.updateBillboardsTexCoords();
88
- }
89
- });
90
- }
91
- }
92
- }
93
-
94
- /**
95
- * Sets image object.
96
- * @public
97
- * @param {Object} image - JavaScript image object.
98
- */
99
- setImage(image) {
100
- this.setSrc(image.src);
101
- }
102
-
103
- /**
104
- * Sets billboard screen size in pixels.
105
- * @public
106
- * @param {number} width - Billboard width.
107
- * @param {number} height - Billboard height.
108
- */
109
- setSize(width, height) {
110
- this._width = width;
111
- this._height = height;
112
- this._handler &&
113
- this._handler.setSizeArr(this._handlerIndex, width * this._scale, height * this._scale);
114
- }
115
-
116
- /**
117
- * Returns billboard screen size.
118
- * @public
119
- * @returns {Object}
120
- */
121
- getSize() {
122
- return {
123
- width: this._width,
124
- height: this._height
125
- };
126
- }
127
-
128
- /**
129
- * Sets billboard screen width.
130
- * @public
131
- * @param {number} width - Width.
132
- */
133
- setWidth(width) {
134
- this.setSize(width, this._height);
135
- }
136
-
137
- /**
138
- * Gets billboard screen width.
139
- * @public
140
- * @returns {number}
141
- */
142
- getWidth() {
143
- return this._width;
144
- }
145
-
146
- /**
147
- * Sets billboard screen heigh.
148
- * @public
149
- * @param {number} height - Height.
150
- */
151
- setHeight(height) {
152
- this.setSize(this._width, height);
153
- }
154
-
155
- /**
156
- * Gets billboard screen height.
157
- * @public
158
- * @returns {number}
159
- */
160
- getHeight() {
161
- return this._height;
162
- }
163
- }
164
-
165
- export { Billboard };
1
+ /**
2
+ * @module og/entity/Billboard
3
+ */
4
+
5
+ "use strict";
6
+
7
+ import { BaseBillboard } from "./BaseBillboard.js";
8
+
9
+ /**
10
+ * Represents basic quad billboard image.
11
+ * @class
12
+ * @extends {BaseBillboard}
13
+ * @param {Object} [options] - Options:
14
+ * @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
15
+ * @param {number} [options.rotation] - Screen angle rotaion.
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
+ * @param {boolean} [options.visibility] - Visibility.
20
+ * @param {string} [options.src] - Billboard image url source.
21
+ * @param {Image} [options.image] - Billboard image object.
22
+ * @param {number} [options.width] - Screen width.
23
+ * @param {number} [options.height] - Screen height.
24
+ * @param {number} [options.scale] - Billboard scale.
25
+ */
26
+ class Billboard extends BaseBillboard {
27
+ constructor(options) {
28
+ super(options);
29
+
30
+ options = options || {};
31
+
32
+ /**
33
+ * Image src.
34
+ * @protected
35
+ * @type {string}
36
+ */
37
+ this._src = options.src || null;
38
+
39
+ /**
40
+ * Image object.
41
+ * @protected
42
+ * @type {Object}
43
+ */
44
+ this._image = options.image || null;
45
+
46
+ this._scale = 1.0;
47
+
48
+ /**
49
+ * Billboard screen width.
50
+ * @protected
51
+ * @type {number}
52
+ */
53
+ this._width = options.width || (options.size ? options.size[0] : 30);
54
+
55
+ /**
56
+ * Billboard screen height.
57
+ * @protected
58
+ * @type {number}
59
+ */
60
+ this._height = options.height || (options.size ? options.size[1] : 30);
61
+ }
62
+
63
+ /**
64
+ * Sets billboard image url source.
65
+ * @public
66
+ * @param {string} src - Image url.
67
+ */
68
+ setSrc(src) {
69
+ this._src = src;
70
+ var bh = this._handler;
71
+ if (bh && src) {
72
+ var rn = bh._entityCollection.renderNode;
73
+ if (rn) {
74
+ var ta = rn.renderer.billboardsTextureAtlas;
75
+ var that = this;
76
+ ta.loadImage(src, function (img) {
77
+ if (ta.get(img.__nodeIndex)) {
78
+ that._image = img;
79
+ bh.setTexCoordArr(
80
+ that._handlerIndex,
81
+ ta.get(that._image.__nodeIndex).texCoords
82
+ );
83
+ } else {
84
+ ta.addImage(img);
85
+ ta.createTexture();
86
+ that._image = img;
87
+ rn.updateBillboardsTexCoords();
88
+ }
89
+ });
90
+ }
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Sets image object.
96
+ * @public
97
+ * @param {Object} image - JavaScript image object.
98
+ */
99
+ setImage(image) {
100
+ this.setSrc(image.src);
101
+ }
102
+
103
+ /**
104
+ * Sets billboard screen size in pixels.
105
+ * @public
106
+ * @param {number} width - Billboard width.
107
+ * @param {number} height - Billboard height.
108
+ */
109
+ setSize(width, height) {
110
+ this._width = width;
111
+ this._height = height;
112
+ this._handler &&
113
+ this._handler.setSizeArr(this._handlerIndex, width * this._scale, height * this._scale);
114
+ }
115
+
116
+ /**
117
+ * Returns billboard screen size.
118
+ * @public
119
+ * @returns {Object}
120
+ */
121
+ getSize() {
122
+ return {
123
+ width: this._width,
124
+ height: this._height
125
+ };
126
+ }
127
+
128
+ /**
129
+ * Sets billboard screen width.
130
+ * @public
131
+ * @param {number} width - Width.
132
+ */
133
+ setWidth(width) {
134
+ this.setSize(width, this._height);
135
+ }
136
+
137
+ /**
138
+ * Gets billboard screen width.
139
+ * @public
140
+ * @returns {number}
141
+ */
142
+ getWidth() {
143
+ return this._width;
144
+ }
145
+
146
+ /**
147
+ * Sets billboard screen heigh.
148
+ * @public
149
+ * @param {number} height - Height.
150
+ */
151
+ setHeight(height) {
152
+ this.setSize(this._width, height);
153
+ }
154
+
155
+ /**
156
+ * Gets billboard screen height.
157
+ * @public
158
+ * @returns {number}
159
+ */
160
+ getHeight() {
161
+ return this._height;
162
+ }
163
+ }
164
+
165
+ export { Billboard };
@@ -866,7 +866,7 @@ class BillboardHandler {
866
866
  var bi = this._billboards[i];
867
867
  var img = bi._image;
868
868
  if (img) {
869
- var imageNode = ta.nodes[bi._image.__nodeIndex];
869
+ var imageNode = ta.get(bi._image.__nodeIndex);
870
870
  if (imageNode) {
871
871
  this.setTexCoordArr(bi._handlerIndex, imageNode.texCoords);
872
872
  }