@openglobus/og 0.11.1 → 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.
- package/package.json +18 -20
- package/src/og/Clock.js +11 -11
- package/src/og/Deferred.js +1 -1
- package/src/og/Events.js +9 -7
- package/src/og/Extent.js +117 -72
- package/src/og/Globe.js +35 -22
- package/src/og/ImageCanvas.js +24 -18
- package/src/og/Lock.js +2 -2
- package/src/og/LonLat.js +40 -37
- package/src/og/Popup.js +21 -15
- package/src/og/QueueArray.js +7 -3
- package/src/og/Rectangle.js +11 -6
- package/src/og/Stack.js +8 -5
- package/src/og/ajax.js +21 -33
- package/src/og/astro/astro.js +5 -5
- package/src/og/astro/earth.js +23 -17
- package/src/og/astro/jd.js +44 -39
- package/src/og/astro/orbit.js +20 -18
- package/src/og/astro/rotation.js +17 -8
- package/src/og/bv/Box.js +7 -3
- package/src/og/bv/Sphere.js +17 -9
- package/src/og/camera/Camera.js +137 -86
- package/src/og/camera/Frustum.js +30 -19
- package/src/og/camera/PlanetCamera.js +30 -26
- package/src/og/control/CompassButton.js +8 -2
- package/src/og/control/Control.js +13 -11
- package/src/og/control/DebugInfo.js +4 -1
- package/src/og/control/EarthCoordinates.js +62 -41
- package/src/og/control/EarthNavigation.js +20 -22
- package/src/og/control/GeoImageDragControl.js +1 -1
- package/src/og/control/KeyboardNavigation.js +12 -12
- package/src/og/control/LayerSwitcher.js +24 -23
- package/src/og/control/Lighting.js +1 -1
- package/src/og/control/MouseNavigation.js +1 -1
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/SegmentBoundVisualization.js +8 -9
- package/src/og/control/ShowFps.js +15 -10
- package/src/og/control/SimpleNavigation.js +8 -10
- package/src/og/control/Sun.js +25 -15
- package/src/og/control/ToggleWireframe.js +5 -5
- package/src/og/control/TouchNavigation.js +58 -45
- package/src/og/control/ZoomControl.js +41 -25
- package/src/og/control/index.js +4 -0
- package/src/og/ellipsoid/Ellipsoid.js +181 -85
- package/src/og/ellipsoid/wgs84.js +4 -4
- package/src/og/entity/BaseBillboard.js +97 -44
- package/src/og/entity/Billboard.js +15 -11
- package/src/og/entity/BillboardHandler.js +314 -64
- package/src/og/entity/Entity.js +106 -74
- package/src/og/entity/EntityCollection.js +72 -49
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/Geometry.js +29 -26
- package/src/og/entity/GeometryHandler.js +598 -126
- package/src/og/entity/Label.js +74 -40
- package/src/og/entity/LabelHandler.js +47 -246
- package/src/og/entity/LabelWorker.js +213 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +81 -33
- package/src/og/entity/PointCloudHandler.js +9 -9
- package/src/og/entity/Polyline.js +39 -39
- package/src/og/entity/Ray.js +61 -28
- package/src/og/entity/ShapeHandler.js +1 -1
- package/src/og/entity/Strip.js +77 -48
- package/src/og/entity/StripHandler.js +27 -27
- package/src/og/entity/index.js +8 -16
- package/src/og/input/KeyboardHandler.js +107 -104
- package/src/og/input/MouseHandler.js +81 -78
- package/src/og/input/TouchHandler.js +55 -51
- package/src/og/layer/BaseGeoImage.js +61 -30
- package/src/og/layer/CanvasTiles.js +26 -24
- package/src/og/layer/GeoImage.js +10 -10
- package/src/og/layer/GeoTexture2d.js +1 -1
- package/src/og/layer/GeoVideo.js +3 -3
- package/src/og/layer/KML.js +66 -40
- package/src/og/layer/Layer.js +27 -17
- package/src/og/layer/Material.js +93 -61
- package/src/og/layer/Vector.js +118 -72
- package/src/og/layer/WMS.js +36 -19
- package/src/og/layer/XYZ.js +55 -48
- package/src/og/light/LightSource.js +47 -40
- package/src/og/math/Line2.js +24 -24
- package/src/og/math/Line3.js +103 -102
- package/src/og/math/Mat3.js +134 -121
- package/src/og/math/Mat4.js +603 -459
- package/src/og/math/Plane.js +21 -20
- package/src/og/math/Quat.js +980 -927
- package/src/og/math/Ray.js +195 -187
- package/src/og/math/Vec2.js +127 -117
- package/src/og/math/Vec3.js +206 -176
- package/src/og/math/Vec4.js +49 -53
- package/src/og/math/coder.js +18 -18
- package/src/og/math.js +12 -12
- package/src/og/mercator.js +11 -11
- package/src/og/proj/EPSG3857.js +4 -4
- package/src/og/proj/EPSG4326.js +4 -4
- package/src/og/proj/Proj.js +31 -31
- package/src/og/quadTree/EntityCollectionNode.js +310 -300
- package/src/og/quadTree/Node.js +1008 -993
- package/src/og/renderer/Renderer.js +768 -747
- package/src/og/renderer/RendererEvents.js +9 -6
- package/src/og/scene/Axes.js +1 -1
- package/src/og/scene/BaseNode.js +8 -9
- package/src/og/scene/Planet.js +115 -87
- package/src/og/scene/RenderNode.js +29 -22
- package/src/og/scene/SkyBox.js +1 -1
- package/src/og/segment/Segment.js +1886 -1878
- package/src/og/segment/SegmentLonLat.js +298 -268
- package/src/og/segment/segmentHelper.js +11 -11
- package/src/og/shaders/bloom.js +1 -1
- package/src/og/shaders/blur.js +2 -2
- package/src/og/shaders/depth.js +1 -1
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/label.js +1 -1
- package/src/og/shaders/lumFilter.js +1 -1
- package/src/og/shaders/pointCloud.js +42 -42
- package/src/og/shaders/screenFrame.js +1 -1
- package/src/og/shaders/shape.js +15 -21
- package/src/og/shaders/skybox.js +37 -37
- package/src/og/shaders/toneMapping.js +1 -1
- package/src/og/shapes/BaseShape.js +129 -57
- package/src/og/shapes/Icosphere.js +30 -15
- package/src/og/shapes/Sphere.js +13 -16
- package/src/og/terrain/BilTerrain.js +2 -1
- package/src/og/terrain/EmptyTerrain.js +2 -2
- package/src/og/terrain/Geoid.js +2 -2
- package/src/og/terrain/GlobusTerrain.js +10 -10
- package/src/og/terrain/MapboxTerrain.js +1 -1
- package/src/og/utils/GeoImageCreator.js +9 -9
- package/src/og/utils/Loader.js +6 -6
- package/src/og/utils/NormalMapCreator.js +13 -13
- package/src/og/utils/TerrainWorker.js +1 -1
- package/src/og/utils/TextureAtlas.js +20 -22
- package/src/og/utils/VectorTileCreator.js +5 -5
- package/src/og/utils/earcut.js +1 -1
- package/src/og/utils/shared.js +15 -15
- package/src/og/webgl/Framebuffer.js +101 -53
- package/src/og/webgl/Handler.js +125 -85
- package/src/og/webgl/Multisample.js +55 -27
- package/src/og/webgl/Program.js +80 -35
- package/src/og/webgl/ProgramController.js +27 -23
- package/src/og/webgl/callbacks.js +8 -8
- package/types/Clock.d.ts +6 -2
- package/types/Deferred.d.ts +1 -1
- package/types/Events.d.ts +8 -4
- package/types/Extent.d.ts +37 -33
- package/types/Globe.d.ts +15 -13
- package/types/ImageCanvas.d.ts +5 -3
- package/types/LonLat.d.ts +24 -24
- package/types/Popup.d.ts +4 -0
- package/types/QueueArray.d.ts +6 -2
- package/types/Rectangle.d.ts +10 -4
- package/types/Stack.d.ts +4 -0
- package/types/ajax.d.ts +1 -1
- package/types/astro/earth.d.ts +3 -2
- package/types/bv/Box.d.ts +10 -5
- package/types/bv/Sphere.d.ts +13 -7
- package/types/camera/Camera.d.ts +90 -81
- package/types/camera/Frustum.d.ts +26 -22
- package/types/camera/PlanetCamera.d.ts +49 -53
- package/types/control/CompassButton.d.ts +4 -4
- package/types/control/Control.d.ts +7 -4
- package/types/control/DebugInfo.d.ts +3 -4
- package/types/control/EarthCoordinates.d.ts +6 -6
- package/types/control/EarthNavigation.d.ts +42 -0
- package/types/control/KeyboardNavigation.d.ts +3 -4
- package/types/control/LayerSwitcher.d.ts +3 -5
- package/types/control/Lighting.d.ts +3 -3
- package/types/control/MouseNavigation.d.ts +47 -0
- package/types/control/ScaleControl.d.ts +3 -3
- package/types/control/ShowFps.d.ts +3 -4
- package/types/control/SimpleNavigation.d.ts +3 -6
- package/types/control/Sun.d.ts +8 -10
- package/types/control/ToggleWireframe.d.ts +3 -3
- package/types/control/TouchNavigation.d.ts +48 -0
- package/types/control/ZoomControl.d.ts +3 -4
- package/types/control/index.d.ts +3 -1
- package/types/ellipsoid/Ellipsoid.d.ts +47 -43
- package/types/ellipsoid/wgs84.d.ts +3 -2
- package/types/entity/BaseBillboard.d.ts +41 -34
- package/types/entity/Billboard.d.ts +7 -7
- package/types/entity/BillboardHandler.d.ts +4 -0
- package/types/entity/Entity.d.ts +101 -83
- package/types/entity/EntityCollection.d.ts +57 -43
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +77 -0
- package/types/entity/Geometry.d.ts +9 -7
- package/types/entity/GeometryHandler.d.ts +2 -2
- package/types/entity/Label.d.ts +24 -29
- package/types/entity/LabelHandler.d.ts +9 -2
- package/types/entity/LabelWorker.d.ts +9 -0
- package/types/entity/PointCloud.d.ts +8 -8
- package/types/entity/PointCloudHandler.d.ts +3 -3
- package/types/entity/Polyline.d.ts +58 -55
- package/types/entity/Ray.d.ts +19 -18
- package/types/entity/Strip.d.ts +8 -7
- package/types/entity/StripHandler.d.ts +3 -3
- package/types/entity/index.d.ts +7 -7
- package/types/input/KeyboardHandler.d.ts +10 -0
- package/types/input/MouseHandler.d.ts +5 -0
- package/types/input/TouchHandler.d.ts +5 -0
- package/types/layer/BaseGeoImage.d.ts +23 -35
- package/types/layer/CanvasTiles.d.ts +15 -22
- package/types/layer/GeoImage.d.ts +5 -18
- package/types/layer/GeoVideo.d.ts +5 -30
- package/types/layer/KML.d.ts +20 -15
- package/types/layer/Layer.d.ts +326 -0
- package/types/layer/Material.d.ts +45 -0
- package/types/layer/Vector.d.ts +208 -0
- package/types/layer/WMS.d.ts +4 -7
- package/types/layer/XYZ.d.ts +19 -25
- package/types/light/LightSource.d.ts +54 -53
- package/types/math/Line2.d.ts +11 -0
- package/types/math/Line3.d.ts +10 -0
- package/types/math/Mat3.d.ts +30 -18
- package/types/math/Mat4.d.ts +71 -52
- package/types/math/Plane.d.ts +5 -4
- package/types/math/Quat.d.ts +379 -0
- package/types/math/Ray.d.ts +82 -0
- package/types/math/Vec2.d.ts +102 -101
- package/types/math/Vec3.d.ts +143 -142
- package/types/math/Vec4.d.ts +40 -39
- package/types/math/coder.d.ts +12 -11
- package/types/math.d.ts +8 -8
- package/types/mercator.d.ts +3 -3
- package/types/proj/EPSG3857.d.ts +3 -2
- package/types/proj/EPSG4326.d.ts +3 -2
- package/types/proj/Proj.d.ts +42 -0
- package/types/quadTree/EntityCollectionNode.d.ts +34 -0
- package/types/quadTree/Node.d.ts +61 -0
- package/types/renderer/Renderer.d.ts +300 -0
- package/types/renderer/RendererEvents.d.ts +10 -7
- package/types/scene/BaseNode.d.ts +9 -9
- package/types/scene/Planet.d.ts +131 -126
- package/types/scene/RenderNode.d.ts +22 -23
- package/types/segment/Segment.d.ts +279 -0
- package/types/segment/SegmentLonLat.d.ts +16 -0
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shapes/BaseShape.d.ts +43 -40
- package/types/shapes/Sphere.d.ts +7 -7
- package/types/terrain/BilTerrain.d.ts +0 -1
- package/types/terrain/EmptyTerrain.d.ts +4 -4
- package/types/terrain/GlobusTerrain.d.ts +17 -54
- package/types/terrain/MapboxTerrain.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +3 -2
- package/types/utils/TextureAtlas.d.ts +8 -8
- package/types/utils/shared.d.ts +25 -24
- package/types/webgl/Framebuffer.d.ts +5 -5
- package/types/webgl/Handler.d.ts +68 -43
- package/types/webgl/Multisample.d.ts +5 -5
- package/types/webgl/Program.d.ts +8 -2
- package/types/webgl/ProgramController.d.ts +18 -13
- package/src/og/inherits.js +0 -8
- package/src/og/utils/polylabel.js +0 -176
- package/types/inherits.d.ts +0 -4
|
@@ -1,268 +1,298 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import { Segment } from "./Segment.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* @
|
|
23
|
-
* @
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
this.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
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
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Extent } from "../Extent.js";
|
|
4
|
+
import { Layer } from "../layer/Layer.js";
|
|
5
|
+
import { LonLat } from "../LonLat.js";
|
|
6
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
7
|
+
import * as mercator from "../mercator.js";
|
|
8
|
+
import { EPSG4326 } from "../proj/EPSG4326.js";
|
|
9
|
+
import * as quadTree from "../quadTree/quadTree.js";
|
|
10
|
+
import { Segment } from "./Segment.js";
|
|
11
|
+
|
|
12
|
+
const _heightLat = 90.0 - mercator.MAX_LAT;
|
|
13
|
+
const _maxPoleZoom = 7;
|
|
14
|
+
const _pieceSize = _heightLat / Math.pow(2, _maxPoleZoom);
|
|
15
|
+
|
|
16
|
+
let _tempHigh = new Vec3(),
|
|
17
|
+
_tempLow = new Vec3();
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Planet segment Web Mercator tile class that stored and rendered with quad tree.
|
|
21
|
+
* @class
|
|
22
|
+
* @extends {Segment}
|
|
23
|
+
* @param {quadNode.Node} node - Quad tree segment node.
|
|
24
|
+
* @param {Planet} planet - Scene planet.
|
|
25
|
+
* @param {Number} tileZoom - Segment tile zoom index.
|
|
26
|
+
* @param {Extent} extent - Segment WGS84 extent.
|
|
27
|
+
*/
|
|
28
|
+
class SegmentLonLat extends Segment {
|
|
29
|
+
/**
|
|
30
|
+
* @param {quadTree.Node} node - Segment node.
|
|
31
|
+
* @param {Planet} planet - Current planet scene.
|
|
32
|
+
* @param {number} tileZoom - Zoom index.
|
|
33
|
+
* @param {Extent} extent - Segment extent.
|
|
34
|
+
*/
|
|
35
|
+
constructor(node, planet, tileZoom, extent) {
|
|
36
|
+
super(node, planet, tileZoom, extent);
|
|
37
|
+
|
|
38
|
+
// TODO:
|
|
39
|
+
// be carefull with functions in constructor _assignTileIndexes
|
|
40
|
+
// this._isNorth = false;
|
|
41
|
+
|
|
42
|
+
this._projection = EPSG4326;
|
|
43
|
+
this._extentMerc = new Extent(
|
|
44
|
+
extent.southWest.forwardMercatorEPS01(),
|
|
45
|
+
extent.northEast.forwardMercatorEPS01()
|
|
46
|
+
);
|
|
47
|
+
this.isPole = true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_setExtentLonLat() {
|
|
51
|
+
this._extentLonLat = this._extent;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
projectNative(coords) {
|
|
55
|
+
return coords;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
getTerrainPoint(xyz, insideSegmentPosition, res, normal) {
|
|
59
|
+
res.copy(this.planet.ellipsoid.hitRay(xyz, xyz.negateTo().normalize()));
|
|
60
|
+
if (normal) {
|
|
61
|
+
normal.copy(res.normal());
|
|
62
|
+
}
|
|
63
|
+
return xyz.length() - res.length();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
acceptForRendering(camera) {
|
|
67
|
+
var maxPoleZoom;
|
|
68
|
+
var lat = this._extent.northEast.lat;
|
|
69
|
+
if (this._isNorth) {
|
|
70
|
+
//north pole limits
|
|
71
|
+
let Yz = Math.floor((90.0 - lat) / _pieceSize);
|
|
72
|
+
maxPoleZoom = Math.floor(Yz / 16) + 7;
|
|
73
|
+
} else {
|
|
74
|
+
//south pole limits
|
|
75
|
+
let Yz = Math.floor((mercator.MIN_LAT - lat) / _pieceSize);
|
|
76
|
+
maxPoleZoom = 12 - Math.floor(Yz / 16);
|
|
77
|
+
}
|
|
78
|
+
return (
|
|
79
|
+
Segment.prototype.acceptForRendering.call(this, camera) || this.tileZoom >= maxPoleZoom
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_assignTileIndexes() {
|
|
84
|
+
var tileZoom = this.tileZoom;
|
|
85
|
+
var extent = this._extent;
|
|
86
|
+
|
|
87
|
+
this.tileX = Math.round(
|
|
88
|
+
Math.abs(-180.0 - extent.southWest.lon) / (extent.northEast.lon - extent.southWest.lon)
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
var lat = extent.northEast.lat;
|
|
92
|
+
|
|
93
|
+
if (lat > 0) {
|
|
94
|
+
//north pole
|
|
95
|
+
this._isNorth = true;
|
|
96
|
+
this._tileGroup = 1;
|
|
97
|
+
this.tileY = Math.round((90.0 - lat) / (extent.northEast.lat - extent.southWest.lat));
|
|
98
|
+
} else {
|
|
99
|
+
//south pole
|
|
100
|
+
this._tileGroup = 2;
|
|
101
|
+
this.tileY = Math.round(
|
|
102
|
+
(mercator.MIN_LAT - lat) / (extent.northEast.lat - extent.southWest.lat)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var p2 = 1 << tileZoom;
|
|
107
|
+
this.tileXE = (this.tileX + 1) % p2;
|
|
108
|
+
this.tileXW = (p2 + this.tileX - 1) % p2;
|
|
109
|
+
|
|
110
|
+
this.tileYN = this.tileY - 1;
|
|
111
|
+
this.tileYS = this.tileY + 1;
|
|
112
|
+
|
|
113
|
+
this.tileIndex = Layer.getTileIndex(this.tileX, this.tileY, tileZoom);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
_createPlainVertices() {
|
|
117
|
+
var gridSize = this.planet.terrain.gridSizeByZoom[this.tileZoom];
|
|
118
|
+
|
|
119
|
+
var e = this._extent,
|
|
120
|
+
fgs = this.planet.terrain.plainGridSize;
|
|
121
|
+
var lonSize = e.getWidth();
|
|
122
|
+
var latSize = e.getHeight();
|
|
123
|
+
var llStep = lonSize / Math.max(fgs, gridSize);
|
|
124
|
+
var ltStep = latSize / gridSize;
|
|
125
|
+
var esw_lon = e.southWest.lon,
|
|
126
|
+
ene_lat = e.northEast.lat;
|
|
127
|
+
var dg = Math.max(fgs / gridSize, 1),
|
|
128
|
+
gs = Math.max(fgs, gridSize) + 1;
|
|
129
|
+
var r2 = this.planet.ellipsoid._invRadii2;
|
|
130
|
+
var ind = 0,
|
|
131
|
+
nmInd = 0;
|
|
132
|
+
const gsgs = gs * gs;
|
|
133
|
+
|
|
134
|
+
var gridSize3 = (gridSize + 1) * (gridSize + 1) * 3;
|
|
135
|
+
|
|
136
|
+
this.plainNormals = new Float32Array(gridSize3);
|
|
137
|
+
this.plainVertices = new Float64Array(gridSize3);
|
|
138
|
+
this.plainVerticesHigh = new Float32Array(gridSize3);
|
|
139
|
+
this.plainVerticesLow = new Float32Array(gridSize3);
|
|
140
|
+
|
|
141
|
+
this.normalMapNormals = new Float32Array(gsgs * 3);
|
|
142
|
+
this.normalMapVertices = new Float64Array(gsgs * 3);
|
|
143
|
+
this.normalMapVerticesHigh = new Float32Array(gsgs * 3);
|
|
144
|
+
this.normalMapVerticesLow = new Float32Array(gsgs * 3);
|
|
145
|
+
|
|
146
|
+
let xmin = 549755748352.0,
|
|
147
|
+
xmax = -549755748352.0,
|
|
148
|
+
ymin = 549755748352.0,
|
|
149
|
+
ymax = -549755748352.0,
|
|
150
|
+
zmin = 549755748352.0,
|
|
151
|
+
zmax = -549755748352.0;
|
|
152
|
+
|
|
153
|
+
var verts = this.plainVertices,
|
|
154
|
+
vertsHigh = this.plainVerticesHigh,
|
|
155
|
+
vertsLow = this.plainVerticesLow,
|
|
156
|
+
norms = this.plainNormals,
|
|
157
|
+
nmVerts = this.normalMapVertices,
|
|
158
|
+
nmVertsHigh = this.normalMapVerticesHigh,
|
|
159
|
+
nmVertsLow = this.normalMapVerticesLow,
|
|
160
|
+
nmNorms = this.normalMapNormals;
|
|
161
|
+
|
|
162
|
+
for (var k = 0; k < gsgs; k++) {
|
|
163
|
+
var j = k % gs,
|
|
164
|
+
i = ~~(k / gs);
|
|
165
|
+
|
|
166
|
+
var v = this.planet.ellipsoid.lonLatToCartesian(
|
|
167
|
+
new LonLat(esw_lon + j * llStep, ene_lat - i * ltStep)
|
|
168
|
+
);
|
|
169
|
+
var nx = v.x * r2.x,
|
|
170
|
+
ny = v.y * r2.y,
|
|
171
|
+
nz = v.z * r2.z;
|
|
172
|
+
var l = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
173
|
+
var nxl = nx * l,
|
|
174
|
+
nyl = ny * l,
|
|
175
|
+
nzl = nz * l;
|
|
176
|
+
|
|
177
|
+
Vec3.doubleToTwoFloats(v, _tempHigh, _tempLow);
|
|
178
|
+
|
|
179
|
+
nmVerts[nmInd] = v.x;
|
|
180
|
+
nmVertsHigh[nmInd] = _tempHigh.x;
|
|
181
|
+
nmVertsLow[nmInd] = _tempLow.x;
|
|
182
|
+
nmNorms[nmInd++] = nxl;
|
|
183
|
+
|
|
184
|
+
nmVerts[nmInd] = v.y;
|
|
185
|
+
nmVertsHigh[nmInd] = _tempHigh.y;
|
|
186
|
+
nmVertsLow[nmInd] = _tempLow.y;
|
|
187
|
+
nmNorms[nmInd++] = nyl;
|
|
188
|
+
|
|
189
|
+
nmVerts[nmInd] = v.z;
|
|
190
|
+
nmVertsHigh[nmInd] = _tempHigh.z;
|
|
191
|
+
nmVertsLow[nmInd] = _tempLow.z;
|
|
192
|
+
nmNorms[nmInd++] = nzl;
|
|
193
|
+
|
|
194
|
+
if (i % dg === 0 && j % dg === 0) {
|
|
195
|
+
verts[ind] = v.x;
|
|
196
|
+
vertsHigh[ind] = _tempHigh.x;
|
|
197
|
+
vertsLow[ind] = _tempLow.x;
|
|
198
|
+
norms[ind++] = nxl;
|
|
199
|
+
|
|
200
|
+
verts[ind] = v.y;
|
|
201
|
+
vertsHigh[ind] = _tempHigh.y;
|
|
202
|
+
vertsLow[ind] = _tempLow.y;
|
|
203
|
+
norms[ind++] = nyl;
|
|
204
|
+
|
|
205
|
+
verts[ind] = v.z;
|
|
206
|
+
vertsHigh[ind] = _tempHigh.z;
|
|
207
|
+
vertsLow[ind] = _tempLow.z;
|
|
208
|
+
norms[ind++] = nzl;
|
|
209
|
+
|
|
210
|
+
if (v.x < xmin) xmin = v.x;
|
|
211
|
+
if (v.x > xmax) xmax = v.x;
|
|
212
|
+
if (v.y < ymin) ymin = v.y;
|
|
213
|
+
if (v.y > ymax) ymax = v.y;
|
|
214
|
+
if (v.z < zmin) zmin = v.z;
|
|
215
|
+
if (v.z > zmax) zmax = v.z;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
this.terrainVertices = verts;
|
|
220
|
+
this.terrainVerticesHigh = vertsHigh;
|
|
221
|
+
this.terrainVerticesLow = vertsLow;
|
|
222
|
+
|
|
223
|
+
//store raw normals
|
|
224
|
+
this.normalMapNormalsRaw = new Float32Array(nmNorms.length);
|
|
225
|
+
this.normalMapNormalsRaw.set(nmNorms);
|
|
226
|
+
|
|
227
|
+
let x = (xmax - xmin) * 0.5,
|
|
228
|
+
y = (ymax - ymin) * 0.5,
|
|
229
|
+
z = (zmax - zmin) * 0.5;
|
|
230
|
+
|
|
231
|
+
this._plainRadius = Math.sqrt(x * x + y * y + z * z);
|
|
232
|
+
|
|
233
|
+
this.plainReady = true;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
_assignGlobalTextureCoordinates() {
|
|
237
|
+
var e = this._extent;
|
|
238
|
+
this._globalTextureCoordinates[0] = (e.southWest.lon + 180.0) / 360.0;
|
|
239
|
+
this._globalTextureCoordinates[1] = (90 - e.northEast.lat) / 180.0;
|
|
240
|
+
this._globalTextureCoordinates[2] = (e.northEast.lon + 180.0) / 360.0;
|
|
241
|
+
this._globalTextureCoordinates[3] = (90 - e.southWest.lat) / 180.0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
_collectVisibleNodes() {
|
|
245
|
+
if (this._isNorth) {
|
|
246
|
+
this.planet._visibleNodesNorth[this.node.nodeId] = this.node;
|
|
247
|
+
} else {
|
|
248
|
+
this.planet._visibleNodesSouth[this.node.nodeId] = this.node;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
isEntityInside(e) {
|
|
253
|
+
return this._extent.isInside(e._lonlat);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
_getLayerExtentOffset(layer) {
|
|
257
|
+
var v0s = layer._extent;
|
|
258
|
+
var v0t = this._extent;
|
|
259
|
+
var sSize_x = v0s.northEast.lon - v0s.southWest.lon;
|
|
260
|
+
var sSize_y = v0s.northEast.lat - v0s.southWest.lat;
|
|
261
|
+
var dV0s_x = (v0t.southWest.lon - v0s.southWest.lon) / sSize_x;
|
|
262
|
+
var dV0s_y = (v0s.northEast.lat - v0t.northEast.lat) / sSize_y;
|
|
263
|
+
var dSize_x = (v0t.northEast.lon - v0t.southWest.lon) / sSize_x;
|
|
264
|
+
var dSize_y = (v0t.northEast.lat - v0t.southWest.lat) / sSize_y;
|
|
265
|
+
return [dV0s_x, dV0s_y, dSize_x, dSize_y];
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
layerOverlap(layer) {
|
|
269
|
+
return this._extent.overlaps(layer._extent);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
getDefaultTexture() {
|
|
273
|
+
return this._isNorth ? this.planet.solidTextureOne : this.planet.solidTextureTwo;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
getExtentLonLat() {
|
|
277
|
+
return this._extent;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
getExtentMerc() {
|
|
281
|
+
return this._extentMerc;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
getNodeState() {
|
|
285
|
+
var vn;
|
|
286
|
+
if (this._isNorth) {
|
|
287
|
+
vn = this.planet._visibleNodesNorth[this.node.nodeId];
|
|
288
|
+
} else {
|
|
289
|
+
vn = this.planet._visibleNodesSouth[this.node.nodeId];
|
|
290
|
+
}
|
|
291
|
+
return (vn && vn.state) || quadTree.NOTRENDERING;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
_freeCache() {
|
|
295
|
+
//empty for a time
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
export { SegmentLonLat };
|
|
@@ -4,7 +4,7 @@ import { N, W, S, E } from '../quadTree/quadTree.js';
|
|
|
4
4
|
|
|
5
5
|
function NewIndexesTypedArray(arr) {
|
|
6
6
|
return new Uint32Array(arr);
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
function createCenterBodyIndexes(size) {
|
|
10
10
|
|
|
@@ -29,7 +29,7 @@ function createCenterBodyIndexes(size) {
|
|
|
29
29
|
indexes.push(indexes[indexes.length - 1], size * size - size);
|
|
30
30
|
|
|
31
31
|
return NewIndexesTypedArray(indexes);
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
|
|
34
34
|
function createWestNeighborSkirt(size, deltaGr) {
|
|
35
35
|
let indexes = [];
|
|
@@ -51,7 +51,7 @@ function createWestNeighborSkirt(size, deltaGr) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
return NewIndexesTypedArray(indexes);
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
|
|
56
56
|
function createNorthNeighborSkirt(size, deltaGr) {
|
|
57
57
|
let indexes = [];
|
|
@@ -72,7 +72,7 @@ function createNorthNeighborSkirt(size, deltaGr) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
return NewIndexesTypedArray(indexes);
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
76
|
|
|
77
77
|
function createEastNeighborSkirt(size, deltaGr) {
|
|
78
78
|
let indexes = [];
|
|
@@ -93,7 +93,7 @@ function createEastNeighborSkirt(size, deltaGr) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
return NewIndexesTypedArray(indexes);
|
|
96
|
-
}
|
|
96
|
+
}
|
|
97
97
|
|
|
98
98
|
function createSouthNeighborSkirt(size, deltaGr) {
|
|
99
99
|
let indexes = [];
|
|
@@ -116,7 +116,7 @@ function createSouthNeighborSkirt(size, deltaGr) {
|
|
|
116
116
|
indexes.push(size * size - size);
|
|
117
117
|
|
|
118
118
|
return NewIndexesTypedArray(indexes);
|
|
119
|
-
}
|
|
119
|
+
}
|
|
120
120
|
|
|
121
121
|
function initIndexesBodySkirts(pow) {
|
|
122
122
|
var table = [];
|
|
@@ -145,7 +145,7 @@ function initIndexesBodySkirts(pow) {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
return table;
|
|
148
|
-
}
|
|
148
|
+
}
|
|
149
149
|
|
|
150
150
|
function initIndexBodiesTable(pow) {
|
|
151
151
|
var table = [];
|
|
@@ -154,7 +154,7 @@ function initIndexBodiesTable(pow) {
|
|
|
154
154
|
table[i] = createCenterBodyIndexes(d + 1);
|
|
155
155
|
}
|
|
156
156
|
return table;
|
|
157
|
-
}
|
|
157
|
+
}
|
|
158
158
|
|
|
159
159
|
function createTextureCoords(size) {
|
|
160
160
|
var texCoords = new Uint16Array((size + 1) * (size + 1) * 2);
|
|
@@ -166,7 +166,7 @@ function createTextureCoords(size) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
return texCoords;
|
|
169
|
-
}
|
|
169
|
+
}
|
|
170
170
|
|
|
171
171
|
class SegmentHelper {
|
|
172
172
|
constructor(maxGridSize = 0) {
|
|
@@ -217,10 +217,10 @@ class SegmentHelper {
|
|
|
217
217
|
}
|
|
218
218
|
return table;
|
|
219
219
|
}
|
|
220
|
-
}
|
|
220
|
+
}
|
|
221
221
|
|
|
222
222
|
let instance = new SegmentHelper();
|
|
223
223
|
|
|
224
224
|
export function getInstance() {
|
|
225
225
|
return instance;
|
|
226
|
-
}
|
|
226
|
+
}
|