@openglobus/og 0.10.4 → 0.11.1

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 (172) hide show
  1. package/css/og.css +1 -1
  2. package/package.json +11 -9
  3. package/src/og/Extent.js +274 -273
  4. package/src/og/Globe.js +11 -3
  5. package/src/og/LonLat.js +152 -146
  6. package/src/og/Popup.js +2 -1
  7. package/src/og/camera/PlanetCamera.js +112 -38
  8. package/src/og/control/EarthNavigation.js +259 -0
  9. package/src/og/control/MouseNavigation.js +68 -40
  10. package/src/og/entity/EntityCollection.js +1 -1
  11. package/src/og/entity/LabelHandler.js +366 -74
  12. package/src/og/entity/Polyline.js +3 -2
  13. package/src/og/layer/CanvasTiles.js +32 -30
  14. package/src/og/layer/KML.js +159 -0
  15. package/src/og/layer/Vector.js +5 -0
  16. package/src/og/layer/index.js +2 -1
  17. package/src/og/math/Vec2.js +448 -448
  18. package/src/og/math/Vec3.js +759 -757
  19. package/src/og/math/Vec4.js +216 -215
  20. package/src/og/quadTree/Node.js +67 -13
  21. package/src/og/renderer/RendererEvents.js +21 -16
  22. package/src/og/scene/Planet.js +25 -10
  23. package/src/og/segment/Segment.js +3 -3
  24. package/src/og/segment/SegmentLonLat.js +7 -0
  25. package/src/og/terrain/GlobusTerrain.js +4 -0
  26. package/src/og/utils/FontAtlas.js +1 -0
  27. package/src/og/utils/GeoImageCreator.js +123 -121
  28. package/src/og/utils/Loader.js +81 -80
  29. package/src/og/utils/NormalMapCreator.js +320 -318
  30. package/src/og/utils/VectorTileCreator.js +251 -250
  31. package/src/og/webgl/Framebuffer.js +265 -264
  32. package/src/og/webgl/Handler.js +1022 -1001
  33. package/src/og/webgl/Multisample.js +169 -168
  34. package/src/og/webgl/ProgramController.js +113 -112
  35. package/types/Clock.d.ts +90 -0
  36. package/types/Deferred.d.ts +6 -0
  37. package/types/Events.d.ts +73 -0
  38. package/types/Extent.d.ts +162 -0
  39. package/types/Globe.d.ts +80 -0
  40. package/types/ImageCanvas.d.ts +121 -0
  41. package/types/Lock.d.ts +12 -0
  42. package/types/LonLat.d.ts +108 -0
  43. package/types/Popup.d.ts +38 -0
  44. package/types/QueueArray.d.ts +15 -0
  45. package/types/Rectangle.d.ts +74 -0
  46. package/types/Stack.d.ts +15 -0
  47. package/types/ajax.d.ts +24 -0
  48. package/types/arial.d.ts +48 -0
  49. package/types/astro/astro.d.ts +38 -0
  50. package/types/astro/earth.d.ts +6 -0
  51. package/types/astro/jd.d.ts +254 -0
  52. package/types/bv/Box.d.ts +25 -0
  53. package/types/bv/Sphere.d.ts +32 -0
  54. package/types/bv/index.d.ts +3 -0
  55. package/types/camera/Camera.d.ts +303 -0
  56. package/types/camera/Frustum.d.ts +129 -0
  57. package/types/camera/PlanetCamera.d.ts +222 -0
  58. package/types/camera/index.d.ts +3 -0
  59. package/types/cons.d.ts +40 -0
  60. package/types/control/CompassButton.d.ts +17 -0
  61. package/types/control/Control.d.ts +101 -0
  62. package/types/control/DebugInfo.d.ts +16 -0
  63. package/types/control/EarthCoordinates.d.ts +47 -0
  64. package/types/control/GeoImageDragControl.d.ts +6 -0
  65. package/types/control/KeyboardNavigation.d.ts +22 -0
  66. package/types/control/LayerSwitcher.d.ts +23 -0
  67. package/types/control/Lighting.d.ts +16 -0
  68. package/types/control/ScaleControl.d.ts +22 -0
  69. package/types/control/ShowFps.d.ts +12 -0
  70. package/types/control/SimpleNavigation.d.ts +28 -0
  71. package/types/control/Sun.d.ts +52 -0
  72. package/types/control/ToggleWireframe.d.ts +12 -0
  73. package/types/control/ZoomControl.d.ts +28 -0
  74. package/types/control/index.d.ts +15 -0
  75. package/types/ellipsoid/Ellipsoid.d.ts +142 -0
  76. package/types/ellipsoid/index.d.ts +3 -0
  77. package/types/ellipsoid/wgs84.d.ts +5 -0
  78. package/types/entity/BaseBillboard.d.ts +208 -0
  79. package/types/entity/Billboard.d.ts +94 -0
  80. package/types/entity/BillboardHandler.d.ts +74 -0
  81. package/types/entity/Entity.d.ts +330 -0
  82. package/types/entity/EntityCollection.d.ts +303 -0
  83. package/types/entity/Geometry.d.ts +72 -0
  84. package/types/entity/GeometryHandler.d.ts +76 -0
  85. package/types/entity/Label.d.ts +194 -0
  86. package/types/entity/LabelHandler.d.ts +24 -0
  87. package/types/entity/PointCloud.d.ts +174 -0
  88. package/types/entity/PointCloudHandler.d.ts +38 -0
  89. package/types/entity/Polyline.d.ts +303 -0
  90. package/types/entity/PolylineHandler.d.ts +18 -0
  91. package/types/entity/Ray.d.ts +123 -0
  92. package/types/entity/RayHandler.d.ts +67 -0
  93. package/types/entity/ShapeHandler.d.ts +22 -0
  94. package/types/entity/Strip.d.ts +118 -0
  95. package/types/entity/StripHandler.d.ts +38 -0
  96. package/types/entity/index.d.ts +8 -0
  97. package/types/index.core.d.ts +65 -0
  98. package/types/index.d.ts +45 -0
  99. package/types/index.webgl.d.ts +7 -0
  100. package/types/inherits.d.ts +4 -0
  101. package/types/input/input.d.ts +34 -0
  102. package/types/layer/BaseGeoImage.d.ts +106 -0
  103. package/types/layer/CanvasTiles.d.ts +75 -0
  104. package/types/layer/GeoImage.d.ts +65 -0
  105. package/types/layer/GeoTexture2d.d.ts +8 -0
  106. package/types/layer/GeoVideo.d.ts +80 -0
  107. package/types/layer/KML.d.ts +58 -0
  108. package/types/layer/WMS.d.ts +66 -0
  109. package/types/layer/XYZ.d.ts +126 -0
  110. package/types/layer/index.d.ts +10 -0
  111. package/types/light/LightSource.d.ts +177 -0
  112. package/types/math/Mat3.d.ts +53 -0
  113. package/types/math/Mat4.d.ts +157 -0
  114. package/types/math/Plane.d.ts +17 -0
  115. package/types/math/Vec2.d.ts +308 -0
  116. package/types/math/Vec3.d.ts +459 -0
  117. package/types/math/Vec4.d.ts +161 -0
  118. package/types/math/coder.d.ts +42 -0
  119. package/types/math/index.d.ts +11 -0
  120. package/types/math.d.ts +261 -0
  121. package/types/mercator.d.ts +92 -0
  122. package/types/proj/EPSG3857.d.ts +5 -0
  123. package/types/proj/EPSG4326.d.ts +5 -0
  124. package/types/quadTree/quadTree.d.ts +40 -0
  125. package/types/renderer/RendererEvents.d.ts +230 -0
  126. package/types/res/images.d.ts +3 -0
  127. package/types/scene/Axes.d.ts +11 -0
  128. package/types/scene/BaseNode.d.ts +60 -0
  129. package/types/scene/Planet.d.ts +572 -0
  130. package/types/scene/RenderNode.d.ts +143 -0
  131. package/types/scene/SkyBox.d.ts +10 -0
  132. package/types/scene/index.d.ts +4 -0
  133. package/types/segment/segmentHelper.d.ts +13 -0
  134. package/types/shaders/billboard.d.ts +3 -0
  135. package/types/shaders/depth.d.ts +2 -0
  136. package/types/shaders/drawnode.d.ts +7 -0
  137. package/types/shaders/label.d.ts +4 -0
  138. package/types/shaders/pointCloud.d.ts +2 -0
  139. package/types/shaders/polyline.d.ts +3 -0
  140. package/types/shaders/ray.d.ts +2 -0
  141. package/types/shaders/screenFrame.d.ts +2 -0
  142. package/types/shaders/shape.d.ts +4 -0
  143. package/types/shaders/skybox.d.ts +2 -0
  144. package/types/shaders/toneMapping.d.ts +2 -0
  145. package/types/shapes/BaseShape.d.ts +247 -0
  146. package/types/shapes/Sphere.d.ts +41 -0
  147. package/types/terrain/BilTerrain.d.ts +8 -0
  148. package/types/terrain/EmptyTerrain.d.ts +72 -0
  149. package/types/terrain/Geoid.d.ts +26 -0
  150. package/types/terrain/GlobusTerrain.d.ts +153 -0
  151. package/types/terrain/MapboxTerrain.d.ts +8 -0
  152. package/types/terrain/index.d.ts +5 -0
  153. package/types/utils/FontAtlas.d.ts +14 -0
  154. package/types/utils/GeoImageCreator.d.ts +29 -0
  155. package/types/utils/ImagesCacheManager.d.ts +10 -0
  156. package/types/utils/Loader.d.ts +25 -0
  157. package/types/utils/NormalMapCreator.d.ts +39 -0
  158. package/types/utils/PlainSegmentWorker.d.ts +10 -0
  159. package/types/utils/TerrainWorker.d.ts +9 -0
  160. package/types/utils/TextureAtlas.d.ts +111 -0
  161. package/types/utils/VectorTileCreator.d.ts +16 -0
  162. package/types/utils/colorTable.d.ts +143 -0
  163. package/types/utils/earcut.d.ts +6 -0
  164. package/types/utils/shared.d.ts +230 -0
  165. package/types/webgl/Framebuffer.d.ts +135 -0
  166. package/types/webgl/Handler.d.ts +372 -0
  167. package/types/webgl/Multisample.d.ts +89 -0
  168. package/types/webgl/Program.d.ts +155 -0
  169. package/types/webgl/ProgramController.d.ts +84 -0
  170. package/types/webgl/callbacks.d.ts +1 -0
  171. package/types/webgl/index.d.ts +6 -0
  172. package/types/webgl/types.d.ts +2 -0
@@ -14,251 +14,252 @@ import { Vec3 } from './Vec3.js';
14
14
  * @param {number} [z] - Third value.
15
15
  * @param {number} [w] - Fourth value.
16
16
  */
17
- const Vec4 = function (x, y, z, w) {
17
+ export class Vec4 {
18
+
19
+ constructor(x, y, z, w) {
20
+
21
+ /**
22
+ * @public
23
+ * @type {number}
24
+ */
25
+ this.x = x || 0.0;
26
+
27
+ /**
28
+ * @public
29
+ * @type {number}
30
+ */
31
+ this.y = y || 0.0;
32
+
33
+ /**
34
+ * @public
35
+ * @type {number}
36
+ */
37
+ this.z = z || 0.0;
38
+
39
+ /**
40
+ * @public
41
+ * @type {number}
42
+ */
43
+ this.w = w || 0.0;
44
+ };
18
45
 
19
46
  /**
20
- * @public
21
- * @type {number}
47
+ * Identity vector [0,0,0,1].
48
+ * @const
49
+ * @type {og.math.Vec4}
22
50
  */
23
- this.x = x || 0.0;
51
+ static get identity() { return new Vec4(0, 0, 0, 1) };
24
52
 
25
53
  /**
26
- * @public
27
- * @type {number}
54
+ * Creates 4d vector from array.
55
+ * @function
56
+ * @param {Array.<number,number,number,number>}
57
+ * @returns {og.math.Vec4}
28
58
  */
29
- this.y = y || 0.0;
59
+ static fromVec(arr) {
60
+ return new Vec4(arr[0], arr[1], arr[2], arr[3]);
61
+ };
30
62
 
31
63
  /**
64
+ * Converts to 3d vector, without fourth value.
32
65
  * @public
33
- * @type {number}
66
+ * @returns {og.Vec3}
34
67
  */
35
- this.z = z || 0.0;
68
+ toVec3() {
69
+ return new Vec3(this.x, this.y, this.z);
70
+ };
36
71
 
37
72
  /**
73
+ * Returns clone vector.
38
74
  * @public
39
- * @type {number}
75
+ * @returns {og.math.Vec4}
40
76
  */
41
- this.w = w || 0.0;
42
- };
43
-
44
- /**
45
- * Identity vector [0,0,0,1].
46
- * @const
47
- * @type {og.math.Vec4}
48
- */
49
- Vec4.identity = new Vec4(0, 0, 0, 1);
50
-
51
- /**
52
- * Vector 4d object creator.
53
- * @function
54
- * @param {number} [x] - First cvalue.
55
- * @param {number} [y] - Second value.
56
- * @param {number} [z] - Third value.
57
- * @param {number} [w] - Fourth value.
58
- * @returns {og.math.Vec4}
59
- */
60
- export function vec4(x, y, z, w) {
61
- return new og.math.Vec4(x, y, z, w);
62
- };
77
+ clone(v) {
78
+ return new Vec4(this.x, this.y, this.z, this.w);
79
+ };
63
80
 
64
- /**
65
- * Creates 4d vector from array.
66
- * @function
67
- * @param {Array.<number,number,number,number>}
68
- * @returns {og.math.Vec4}
69
- */
70
- Vec4.fromVec = function (arr) {
71
- return new Vec4(arr[0], arr[1], arr[2], arr[3]);
72
- };
81
+ /**
82
+ * Compares with vector. Returns true if it equals another.
83
+ * @public
84
+ * @param {og.math.Vec4} p - Vector to compare.
85
+ * @returns {boolean}
86
+ */
87
+ equal(v) {
88
+ return this.x === v.x && this.y === v.y && this.z === v.z && this.w === v.w;
89
+ };
73
90
 
74
- /**
75
- * Converts to 3d vector, without fourth value.
76
- * @public
77
- * @returns {og.Vec3}
78
- */
79
- Vec4.prototype.toVec3 = function () {
80
- return new Vec3(this.x, this.y, this.z);
81
- };
91
+ /**
92
+ * Copy input vector's values.
93
+ * @param {og.math.Vec4} v - Vector to copy.
94
+ * @returns {og.math.Vec4}
95
+ */
96
+ copy(v) {
97
+ this.x = v.x;
98
+ this.y = v.y;
99
+ this.z = v.z;
100
+ this.w = v.w;
101
+ return this;
102
+ };
82
103
 
83
- /**
84
- * Returns clone vector.
85
- * @public
86
- * @returns {og.math.Vec4}
87
- */
88
- Vec4.prototype.clone = function (v) {
89
- return new Vec4(this.x, this.y, this.z, this.w);
90
- };
104
+ /**
105
+ * Converts vector to a number array.
106
+ * @public
107
+ * @returns {Array.<number,number,number,number>}
108
+ * @deprecated
109
+ */
110
+ toVec() {
111
+ return [this.x, this.y, this.z, this.w];
112
+ };
91
113
 
92
- /**
93
- * Compares with vector. Returns true if it equals another.
94
- * @public
95
- * @param {og.math.Vec4} p - Vector to compare.
96
- * @returns {boolean}
97
- */
98
- Vec4.prototype.equal = function (v) {
99
- return this.x === v.x && this.y === v.y && this.z === v.z && this.w === v.w;
100
- };
114
+ /**
115
+ * Converts vector to a number array.
116
+ * @public
117
+ * @returns {Array.<number,number,number,number>}
118
+ */
119
+ toArray() {
120
+ return [this.x, this.y, this.z, this.w];
121
+ };
101
122
 
102
- /**
103
- * Copy input vector's values.
104
- * @param {og.math.Vec4} v - Vector to copy.
105
- * @returns {og.math.Vec4}
106
- */
107
- Vec4.prototype.copy = function (v) {
108
- this.x = v.x;
109
- this.y = v.y;
110
- this.z = v.z;
111
- this.w = v.w;
112
- return this;
113
- };
123
+ /**
124
+ * Sets vector's values.
125
+ * @public
126
+ * @param {number} x - Value X.
127
+ * @param {number} y - Value Y.
128
+ * @param {number} z - Value Z.
129
+ * @param {number} w - Value W.
130
+ * @returns {og.math.Vec4}
131
+ */
132
+ set(x, y, z, w) {
133
+ this.x = x;
134
+ this.y = y;
135
+ this.z = z;
136
+ this.w = w;
137
+ return this;
138
+ };
114
139
 
115
- /**
116
- * Converts vector to a number array.
117
- * @public
118
- * @returns {Array.<number,number,number,number>}
119
- * @deprecated
120
- */
121
- Vec4.prototype.toVec = function () {
122
- return [this.x, this.y, this.z, this.w];
123
- };
140
+ /**
141
+ * Adds vector to the current.
142
+ * @public
143
+ * @param {og.math.Vec4}
144
+ * @returns {og.math.Vec4}
145
+ */
146
+ addA(v) {
147
+ this.x += v.x;
148
+ this.y += v.y;
149
+ this.z += v.z;
150
+ this.w += v.w;
151
+ return this;
152
+ };
124
153
 
125
- /**
126
- * Converts vector to a number array.
127
- * @public
128
- * @returns {Array.<number,number,number,number>}
129
- */
130
- Vec4.prototype.toArray = function () {
131
- return [this.x, this.y, this.z, this.w];
132
- };
154
+ /**
155
+ * Subtract vector from the current.
156
+ * @public
157
+ * @param {og.math.Vec4} v - Subtract vector.
158
+ * @returns {og.math.Vec4}
159
+ */
160
+ subA(v) {
161
+ this.x -= v.x;
162
+ this.y -= v.y;
163
+ this.z -= v.z;
164
+ this.w -= v.w;
165
+ return this;
166
+ };
133
167
 
134
- /**
135
- * Sets vector's values.
136
- * @public
137
- * @param {number} x - Value X.
138
- * @param {number} y - Value Y.
139
- * @param {number} z - Value Z.
140
- * @param {number} w - Value W.
141
- * @returns {og.math.Vec4}
142
- */
143
- Vec4.prototype.set = function (x, y, z, w) {
144
- this.x = x;
145
- this.y = y;
146
- this.z = z;
147
- this.w = w;
148
- return this;
149
- };
168
+ /**
169
+ * Scale current vector.
170
+ * @public
171
+ * @param {number} scale - Scale value.
172
+ * @returns {og.math.Vec4}
173
+ */
174
+ scale(scale) {
175
+ this.x *= scale;
176
+ this.y *= scale;
177
+ this.z *= scale;
178
+ this.w *= scale;
179
+ return this;
180
+ };
150
181
 
151
- /**
152
- * Adds vector to the current.
153
- * @public
154
- * @param {og.math.Vec4}
155
- * @returns {og.math.Vec4}
156
- */
157
- Vec4.prototype.addA = function (v) {
158
- this.x += v.x;
159
- this.y += v.y;
160
- this.z += v.z;
161
- this.w += v.w;
162
- return this;
163
- };
182
+ /**
183
+ * Makes vector affinity. Thereby fourh component becomes to 1.0.
184
+ * @public
185
+ * @returns {og.math.Vec4}
186
+ */
187
+ affinity() {
188
+ var iw = 1 / this.w;
189
+ this.x *= iw;
190
+ this.y *= iw;
191
+ this.z *= iw;
192
+ this.w = 1.0;
193
+ return this;
194
+ };
164
195
 
165
- /**
166
- * Subtract vector from the current.
167
- * @public
168
- * @param {og.math.Vec4} v - Subtract vector.
169
- * @returns {og.math.Vec4}
170
- */
171
- Vec4.prototype.subA = function (v) {
172
- this.x -= v.x;
173
- this.y -= v.y;
174
- this.z -= v.z;
175
- this.w -= v.w;
176
- return this;
177
- };
196
+ /**
197
+ * Scale current vector to another instance.
198
+ * @public
199
+ * @param {number} scale - Scale value.
200
+ * @returns {og.Vec3}
201
+ */
202
+ scaleTo(scale) {
203
+ return new Vec4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);
204
+ };
178
205
 
179
- /**
180
- * Scale current vector.
181
- * @public
182
- * @param {number} scale - Scale value.
183
- * @returns {og.math.Vec4}
184
- */
185
- Vec4.prototype.scale = function (scale) {
186
- this.x *= scale;
187
- this.y *= scale;
188
- this.z *= scale;
189
- this.w *= scale;
190
- return this;
191
- };
206
+ /**
207
+ * Vector's edge function that returns vector where each component is 0.0 if it's smaller then edge and otherwise 1.0.
208
+ * @public
209
+ * @returns {og.math.Vec4}
210
+ */
211
+ getStep(edge) {
212
+ return new Vec4(
213
+ this.x < edge ? 0.0 : 1.0,
214
+ this.y < edge ? 0.0 : 1.0,
215
+ this.z < edge ? 0.0 : 1.0,
216
+ this.w < edge ? 0.0 : 1.0
217
+ );
218
+ };
192
219
 
193
- /**
194
- * Makes vector affinity. Thereby fourh component becomes to 1.0.
195
- * @public
196
- * @returns {og.math.Vec4}
197
- */
198
- Vec4.prototype.affinity = function () {
199
- var iw = 1 / this.w;
200
- this.x *= iw;
201
- this.y *= iw;
202
- this.z *= iw;
203
- this.w = 1.0;
204
- return this;
205
- };
220
+ /**
221
+ * The vector fract function returns the vector of fractional parts of each value, i.e. x minus floor(x).
222
+ * @public
223
+ * @returns {og.math.Vec4}
224
+ */
225
+ getFrac(v) {
226
+ return new Vec4(
227
+ og.math.frac(v.x),
228
+ og.math.frac(v.y),
229
+ og.math.frac(v.z),
230
+ og.math.frac(v.w)
231
+ );
232
+ };
206
233
 
207
- /**
208
- * Scale current vector to another instance.
209
- * @public
210
- * @param {number} scale - Scale value.
211
- * @returns {og.Vec3}
212
- */
213
- Vec4.prototype.scaleTo = function (scale) {
214
- return new Vec4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);
215
- };
234
+ /**
235
+ * Gets vectors dot production.
236
+ * @public
237
+ * @param {og.math.Vec4} v - Another vector.
238
+ * @returns {number} - Dot product.
239
+ */
240
+ dot(v) {
241
+ return v.x * this.x + v.y * this.y + v.z * this.z + v.w * this.w;
242
+ };
216
243
 
217
- /**
218
- * Vector's edge function that returns vector where each component is 0.0 if it's smaller then edge and otherwise 1.0.
219
- * @public
220
- * @returns {og.math.Vec4}
221
- */
222
- Vec4.prototype.getStep = function (edge) {
223
- return new Vec4(
224
- this.x < edge ? 0.0 : 1.0,
225
- this.y < edge ? 0.0 : 1.0,
226
- this.z < edge ? 0.0 : 1.0,
227
- this.w < edge ? 0.0 : 1.0
228
- );
229
- };
244
+ /**
245
+ * Returns true if vector's values are zero.
246
+ * @public
247
+ * @returns {boolean} -
248
+ */
249
+ isZero() {
250
+ return !(this.x || this.y || this.z || this.w);
251
+ };
252
+ }
230
253
 
231
254
  /**
232
- * The vector fract function returns the vector of fractional parts of each value, i.e. x minus floor(x).
233
- * @public
255
+ * Vector 4d object creator.
256
+ * @function
257
+ * @param {number} [x] - First cvalue.
258
+ * @param {number} [y] - Second value.
259
+ * @param {number} [z] - Third value.
260
+ * @param {number} [w] - Fourth value.
234
261
  * @returns {og.math.Vec4}
235
262
  */
236
- Vec4.prototype.getFrac = function (v) {
237
- return new Vec4(
238
- og.math.frac(v.x),
239
- og.math.frac(v.y),
240
- og.math.frac(v.z),
241
- og.math.frac(v.w)
242
- );
243
- };
244
-
245
- /**
246
- * Gets vectors dot production.
247
- * @public
248
- * @param {og.math.Vec4} v - Another vector.
249
- * @returns {number} - Dot product.
250
- */
251
- Vec4.prototype.dot = function (v) {
252
- return v.x * this.x + v.y * this.y + v.z * this.z + v.w * this.w;
253
- };
254
-
255
- /**
256
- * Returns true if vector's values are zero.
257
- * @public
258
- * @returns {boolean} -
259
- */
260
- Vec4.prototype.isZero = function () {
261
- return !(this.x || this.y || this.z || this.w);
263
+ export function vec4(x, y, z, w) {
264
+ return new og.math.Vec4(x, y, z, w);
262
265
  };
263
-
264
- export { Vec4 };
@@ -32,7 +32,7 @@ import {
32
32
 
33
33
  import { MAX_NORMAL_ZOOM } from "../segment/Segment.js";
34
34
 
35
- const VISIBLE_HEIGHT = 3000000.0;
35
+ const VISIBLE_HEIGHT = 1400000.0;
36
36
 
37
37
  let _tempHigh = new Vec3(),
38
38
  _tempLow = new Vec3();
@@ -331,7 +331,7 @@ Node.prototype.prepareForRendering = function (
331
331
  } else {
332
332
  if (seg.tileZoom < 2) {
333
333
  this.renderNode(inFrustum, !inFrustum, terrainReadySegment, stopLoading);
334
- } else if (seg.tileZoom >= MAX_NORMAL_ZOOM) {
334
+ } else if (seg.tileZoom > MAX_NORMAL_ZOOM) {
335
335
  this.renderNode(inFrustum, !inFrustum, terrainReadySegment, stopLoading);
336
336
  } else if (
337
337
  seg._swNorm.dot(cam._n) > 0.0 ||
@@ -477,26 +477,80 @@ Node.prototype.getCommonSide = function (node) {
477
477
  b_sw_lon = b_sw.lon,
478
478
  b_sw_lat = b_sw.lat;
479
479
 
480
+ if (as._tileGroup === bs._tileGroup) {
481
+ if (
482
+ a_ne_lon === b_sw_lon &&
483
+ ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
484
+ (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
485
+ ) {
486
+ return E;
487
+ } else if (
488
+ a_sw_lon === b_ne_lon &&
489
+ ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
490
+ (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
491
+ ) {
492
+ return W;
493
+ } else if (
494
+ a_ne_lat === b_sw_lat &&
495
+ ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
496
+ (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
497
+ ) {
498
+ return N;
499
+ } else if (
500
+ a_sw_lat === b_ne_lat &&
501
+ ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
502
+ (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
503
+ ) {
504
+ return S;
505
+ } else if (
506
+ bs.tileX === 0 &&
507
+ as.tileX === Math.pow(2, as.tileZoom) - 1 &&
508
+ ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
509
+ (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
510
+ ) {
511
+ return E;
512
+ } else if (
513
+ as.tileX === 0 &&
514
+ bs.tileX === Math.pow(2, bs.tileZoom) - 1 &&
515
+ ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
516
+ (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
517
+ ) {
518
+ return W;
519
+ }
520
+ }
521
+
480
522
  if (
481
- a_ne_lon === b_sw_lon &&
482
- ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
483
- (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
523
+ as._tileGroup === 0 &&
524
+ bs._tileGroup === 1 &&
525
+ as.tileY === 0 &&
526
+ bs.tileY === Math.pow(2, bs.tileZoom) - 1 &&
527
+ ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
528
+ (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
484
529
  ) {
485
- return E;
530
+ return N;
486
531
  } else if (
487
- a_sw_lon === b_ne_lon &&
488
- ((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
489
- (a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
532
+ as._tileGroup === 2 &&
533
+ bs._tileGroup === 0 &&
534
+ as.tileY === 0 &&
535
+ bs.tileY === Math.pow(2, bs.tileZoom) - 1 &&
536
+ ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
537
+ (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
490
538
  ) {
491
- return W;
539
+ return N;
492
540
  } else if (
493
- a_ne_lat === b_sw_lat &&
541
+ bs._tileGroup === 1 &&
542
+ as._tileGroup === 0 &&
543
+ as.tileY === Math.pow(2, as.tileZoom) - 1 &&
544
+ bs.tileY === 0 &&
494
545
  ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
495
546
  (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
496
547
  ) {
497
- return N;
548
+ return S;
498
549
  } else if (
499
- a_sw_lat === b_ne_lat &&
550
+ as._tileGroup === 1 &&
551
+ bs._tileGroup === 0 &&
552
+ as.tileY === Math.pow(2, as.tileZoom) - 1 &&
553
+ bs.tileY === 0 &&
500
554
  ((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
501
555
  (a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
502
556
  ) {
@@ -301,33 +301,38 @@ class RendererEvents extends Events {
301
301
  }
302
302
 
303
303
  /**
304
- * @private
304
+ * @protected
305
305
  */
306
- onMouseMove(event, sys) {
307
- let b = sys.buttons;
308
-
309
- if (b & LB_M) {
310
- this.mouseState.leftButtonDown = true;
306
+ updateButtonsStates(buttons) {
307
+ var ms = this.mouseState;
308
+ if (buttons & LB_M) {
309
+ ms.leftButtonDown = true;
311
310
  } else {
312
- this.mouseState.leftButtonHold = false;
313
- this.mouseState.leftButtonDown = false;
311
+ ms.leftButtonHold = false;
312
+ ms.leftButtonDown = false;
314
313
  }
315
314
 
316
- if (b & RB_M) {
317
- this.mouseState.rightButtonDown = true;
315
+ if (buttons & RB_M) {
316
+ ms.rightButtonDown = true;
318
317
  } else {
319
- this.mouseState.rightButtonHold = false;
320
- this.mouseState.rightButtonDown = false;
318
+ ms.rightButtonHold = false;
319
+ ms.rightButtonDown = false;
321
320
  }
322
321
 
323
- if (b & MB_M) {
324
- this.mouseState.middleButtonDown = true;
322
+ if (buttons & MB_M) {
323
+ ms.middleButtonDown = true;
325
324
  } else {
326
- this.mouseState.middleButtonHold = false;
327
- this.mouseState.middleButtonDown = false;
325
+ ms.middleButtonHold = false;
326
+ ms.middleButtonDown = false;
328
327
  }
328
+ }
329
329
 
330
+ /**
331
+ * @private
332
+ */
333
+ onMouseMove(event, sys) {
330
334
  var ms = this.mouseState;
335
+ this.updateButtonsStates(sys.buttons)
331
336
  ms.sys = event;
332
337
 
333
338
  let ex = event.clientX,