@openglobus/og 0.11.2 → 0.11.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.
- package/package.json +13 -13
- package/src/og/Clock.js +10 -10
- package/src/og/Events.js +8 -6
- package/src/og/Extent.js +82 -41
- package/src/og/Globe.js +25 -13
- package/src/og/ImageCanvas.js +22 -16
- package/src/og/LonLat.js +16 -13
- package/src/og/Popup.js +21 -14
- package/src/og/QueueArray.js +6 -2
- package/src/og/Rectangle.js +11 -6
- package/src/og/Stack.js +5 -2
- package/src/og/ajax.js +21 -33
- package/src/og/astro/astro.js +5 -5
- package/src/og/astro/earth.js +22 -16
- package/src/og/astro/jd.js +23 -18
- package/src/og/astro/orbit.js +13 -11
- package/src/og/astro/rotation.js +17 -8
- package/src/og/bv/Box.js +7 -3
- package/src/og/bv/Sphere.js +14 -11
- package/src/og/camera/Camera.js +51 -54
- package/src/og/camera/Frustum.js +29 -18
- package/src/og/camera/PlanetCamera.js +32 -23
- package/src/og/control/CompassButton.js +5 -1
- package/src/og/control/Control.js +12 -10
- package/src/og/control/DebugInfo.js +4 -1
- package/src/og/control/EarthCoordinates.js +54 -33
- package/src/og/control/KeyboardNavigation.js +10 -10
- package/src/og/control/LayerSwitcher.js +22 -21
- package/src/og/control/Lighting.js +34 -3
- package/src/og/control/MouseNavigation.js +1 -1
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/SegmentBoundVisualization.js +6 -7
- package/src/og/control/ShowFps.js +13 -8
- package/src/og/control/SimpleNavigation.js +6 -8
- package/src/og/control/Sun.js +25 -15
- package/src/og/control/ToggleWireframe.js +4 -4
- package/src/og/control/TouchNavigation.js +44 -33
- package/src/og/control/ZoomControl.js +41 -25
- package/src/og/ellipsoid/Ellipsoid.js +162 -66
- package/src/og/ellipsoid/wgs84.js +4 -4
- package/src/og/entity/BaseBillboard.js +100 -56
- package/src/og/entity/Billboard.js +14 -10
- package/src/og/entity/BillboardHandler.js +317 -60
- package/src/og/entity/Entity.js +100 -68
- package/src/og/entity/EntityCollection.js +70 -47
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/Geometry.js +27 -24
- package/src/og/entity/GeometryHandler.js +596 -124
- package/src/og/entity/Label.js +80 -49
- package/src/og/entity/LabelHandler.js +45 -244
- package/src/og/entity/LabelWorker.js +218 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +80 -32
- package/src/og/entity/PointCloudHandler.js +8 -8
- package/src/og/entity/Polyline.js +16 -16
- package/src/og/entity/Ray.js +60 -27
- package/src/og/entity/Strip.js +77 -48
- package/src/og/entity/StripHandler.js +26 -26
- package/src/og/entity/index.js +8 -16
- package/src/og/layer/BaseGeoImage.js +54 -23
- package/src/og/layer/CanvasTiles.js +24 -24
- package/src/og/layer/GeoImage.js +9 -9
- package/src/og/layer/GeoVideo.js +3 -3
- package/src/og/layer/KML.js +63 -37
- package/src/og/layer/Layer.js +44 -21
- package/src/og/layer/Material.js +23 -20
- package/src/og/layer/Vector.js +114 -68
- package/src/og/layer/WMS.js +34 -17
- package/src/og/layer/XYZ.js +48 -46
- package/src/og/light/LightSource.js +46 -39
- package/src/og/math/Mat3.js +34 -22
- package/src/og/math/Mat4.js +603 -459
- package/src/og/math/Plane.js +21 -20
- package/src/og/math/Quat.js +182 -139
- package/src/og/math/Ray.js +38 -33
- package/src/og/math/Vec2.js +85 -75
- package/src/og/math/Vec3.js +142 -112
- package/src/og/math/Vec4.js +27 -31
- package/src/og/math/coder.js +10 -10
- package/src/og/math.js +12 -12
- package/src/og/proj/EPSG3857.js +4 -4
- package/src/og/proj/EPSG4326.js +4 -4
- package/src/og/proj/Proj.js +4 -6
- package/src/og/quadTree/Node.js +8 -8
- package/src/og/renderer/Renderer.js +59 -52
- package/src/og/renderer/RendererEvents.js +50 -27
- package/src/og/scene/BaseNode.js +7 -8
- package/src/og/scene/Planet.js +102 -103
- package/src/og/scene/RenderNode.js +28 -21
- package/src/og/segment/Segment.js +26 -21
- package/src/og/segment/SegmentLonLat.js +5 -5
- package/src/og/shaders/drawnode.js +135 -142
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/pointCloud.js +41 -41
- package/src/og/shaders/shape.js +12 -18
- package/src/og/shaders/skybox.js +36 -36
- package/src/og/shaders/toneMapping.js +1 -0
- package/src/og/shapes/BaseShape.js +126 -54
- package/src/og/shapes/Icosphere.js +29 -14
- package/src/og/shapes/Sphere.js +12 -15
- package/src/og/terrain/BilTerrain.js +1 -0
- package/src/og/terrain/EmptyTerrain.js +2 -2
- package/src/og/terrain/GlobusTerrain.js +9 -9
- package/src/og/utils/FontAtlas.js +6 -2
- package/src/og/utils/TextureAtlas.js +22 -24
- package/src/og/utils/VectorTileCreator.js +1 -3
- package/src/og/utils/shared.js +16 -16
- package/src/og/webgl/Framebuffer.js +88 -40
- package/src/og/webgl/Handler.js +243 -169
- package/src/og/webgl/Multisample.js +47 -19
- package/src/og/webgl/Program.js +79 -34
- package/src/og/webgl/ProgramController.js +17 -13
- package/src/og/webgl/callbacks.js +8 -8
- package/src/og/inherits.js +0 -8
- package/src/og/utils/polylabel.js +0 -176
- package/types/Clock.d.ts +0 -90
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -73
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -75
- package/types/ImageCanvas.d.ts +0 -121
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -108
- package/types/Popup.d.ts +0 -38
- package/types/QueueArray.d.ts +0 -15
- package/types/Rectangle.d.ts +0 -74
- package/types/Stack.d.ts +0 -15
- package/types/ajax.d.ts +0 -24
- package/types/arial.d.ts +0 -48
- package/types/astro/astro.d.ts +0 -38
- package/types/astro/earth.d.ts +0 -6
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -25
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -303
- package/types/camera/Frustum.d.ts +0 -129
- package/types/camera/PlanetCamera.d.ts +0 -223
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/CompassButton.d.ts +0 -18
- package/types/control/Control.d.ts +0 -101
- package/types/control/DebugInfo.d.ts +0 -16
- package/types/control/EarthCoordinates.d.ts +0 -47
- package/types/control/EarthNavigation.d.ts +0 -42
- package/types/control/GeoImageDragControl.d.ts +0 -6
- package/types/control/KeyboardNavigation.d.ts +0 -22
- package/types/control/LayerSwitcher.d.ts +0 -23
- package/types/control/Lighting.d.ts +0 -16
- package/types/control/MouseNavigation.d.ts +0 -51
- package/types/control/ScaleControl.d.ts +0 -22
- package/types/control/ShowFps.d.ts +0 -12
- package/types/control/SimpleNavigation.d.ts +0 -28
- package/types/control/Sun.d.ts +0 -52
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -50
- package/types/control/ZoomControl.d.ts +0 -28
- package/types/control/index.d.ts +0 -17
- package/types/ellipsoid/Ellipsoid.d.ts +0 -142
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -5
- package/types/entity/BaseBillboard.d.ts +0 -208
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -74
- package/types/entity/Entity.d.ts +0 -331
- package/types/entity/EntityCollection.d.ts +0 -303
- package/types/entity/Geometry.d.ts +0 -73
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -194
- package/types/entity/LabelHandler.d.ts +0 -24
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -304
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -123
- package/types/entity/RayHandler.d.ts +0 -67
- package/types/entity/ShapeHandler.d.ts +0 -22
- package/types/entity/Strip.d.ts +0 -118
- package/types/entity/StripHandler.d.ts +0 -38
- package/types/entity/index.d.ts +0 -8
- package/types/index.core.d.ts +0 -65
- package/types/index.d.ts +0 -45
- package/types/index.webgl.d.ts +0 -7
- package/types/inherits.d.ts +0 -4
- package/types/input/KeyboardHandler.d.ts +0 -10
- package/types/input/MouseHandler.d.ts +0 -5
- package/types/input/TouchHandler.d.ts +0 -5
- package/types/input/input.d.ts +0 -34
- package/types/layer/BaseGeoImage.d.ts +0 -107
- package/types/layer/CanvasTiles.d.ts +0 -75
- package/types/layer/GeoImage.d.ts +0 -65
- package/types/layer/GeoTexture2d.d.ts +0 -8
- package/types/layer/GeoVideo.d.ts +0 -80
- package/types/layer/KML.d.ts +0 -58
- package/types/layer/Layer.d.ts +0 -321
- package/types/layer/Material.d.ts +0 -48
- package/types/layer/Vector.d.ts +0 -228
- package/types/layer/WMS.d.ts +0 -66
- package/types/layer/XYZ.d.ts +0 -130
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -177
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -63
- package/types/math/Mat4.d.ts +0 -173
- package/types/math/Plane.d.ts +0 -17
- package/types/math/Quat.d.ts +0 -376
- package/types/math/Ray.d.ts +0 -81
- package/types/math/Vec2.d.ts +0 -308
- package/types/math/Vec3.d.ts +0 -459
- package/types/math/Vec4.d.ts +0 -161
- package/types/math/coder.d.ts +0 -42
- package/types/math/index.d.ts +0 -11
- package/types/math.d.ts +0 -261
- package/types/mercator.d.ts +0 -92
- package/types/proj/EPSG3857.d.ts +0 -5
- package/types/proj/EPSG4326.d.ts +0 -5
- package/types/proj/Proj.d.ts +0 -42
- package/types/quadTree/EntityCollectionNode.d.ts +0 -34
- package/types/quadTree/Node.d.ts +0 -61
- package/types/quadTree/quadTree.d.ts +0 -40
- package/types/renderer/Renderer.d.ts +0 -296
- package/types/renderer/RendererEvents.d.ts +0 -230
- package/types/res/images.d.ts +0 -3
- package/types/scene/Axes.d.ts +0 -11
- package/types/scene/BaseNode.d.ts +0 -60
- package/types/scene/Planet.d.ts +0 -574
- package/types/scene/RenderNode.d.ts +0 -143
- package/types/scene/SkyBox.d.ts +0 -10
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -271
- package/types/segment/SegmentLonLat.d.ts +0 -62
- package/types/segment/segmentHelper.d.ts +0 -13
- package/types/shaders/billboard.d.ts +0 -3
- package/types/shaders/depth.d.ts +0 -2
- package/types/shaders/drawnode.d.ts +0 -7
- package/types/shaders/label.d.ts +0 -4
- package/types/shaders/pointCloud.d.ts +0 -2
- package/types/shaders/polyline.d.ts +0 -3
- package/types/shaders/ray.d.ts +0 -2
- package/types/shaders/screenFrame.d.ts +0 -2
- package/types/shaders/shape.d.ts +0 -4
- package/types/shaders/skybox.d.ts +0 -2
- package/types/shaders/toneMapping.d.ts +0 -2
- package/types/shapes/BaseShape.d.ts +0 -247
- package/types/shapes/Sphere.d.ts +0 -41
- package/types/terrain/BilTerrain.d.ts +0 -8
- package/types/terrain/EmptyTerrain.d.ts +0 -72
- package/types/terrain/Geoid.d.ts +0 -26
- package/types/terrain/GlobusTerrain.d.ts +0 -153
- package/types/terrain/MapboxTerrain.d.ts +0 -8
- package/types/terrain/index.d.ts +0 -5
- package/types/utils/FontAtlas.d.ts +0 -14
- package/types/utils/GeoImageCreator.d.ts +0 -30
- package/types/utils/ImagesCacheManager.d.ts +0 -10
- package/types/utils/Loader.d.ts +0 -25
- package/types/utils/NormalMapCreator.d.ts +0 -39
- package/types/utils/PlainSegmentWorker.d.ts +0 -10
- package/types/utils/TerrainWorker.d.ts +0 -9
- package/types/utils/TextureAtlas.d.ts +0 -111
- package/types/utils/VectorTileCreator.d.ts +0 -16
- package/types/utils/colorTable.d.ts +0 -143
- package/types/utils/earcut.d.ts +0 -6
- package/types/utils/shared.d.ts +0 -230
- package/types/webgl/Framebuffer.d.ts +0 -135
- package/types/webgl/Handler.d.ts +0 -372
- package/types/webgl/Multisample.d.ts +0 -89
- package/types/webgl/Program.d.ts +0 -155
- package/types/webgl/ProgramController.d.ts +0 -84
- package/types/webgl/callbacks.d.ts +0 -1
- package/types/webgl/index.d.ts +0 -6
- package/types/webgl/types.d.ts +0 -2
package/src/og/entity/Strip.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import * as utils from
|
|
4
|
-
import { Vec3 } from
|
|
5
|
-
import { Line3 } from
|
|
3
|
+
import * as utils from "../utils/shared.js";
|
|
4
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
5
|
+
import { Line3 } from "../math/Line3.js";
|
|
6
6
|
|
|
7
7
|
let _tempHigh = new Vec3(),
|
|
8
8
|
_tempLow = new Vec3();
|
|
@@ -25,7 +25,6 @@ let _tempHigh = new Vec3(),
|
|
|
25
25
|
*/
|
|
26
26
|
class Strip {
|
|
27
27
|
constructor(options) {
|
|
28
|
-
|
|
29
28
|
options = options || {};
|
|
30
29
|
|
|
31
30
|
/**
|
|
@@ -41,7 +40,7 @@ class Strip {
|
|
|
41
40
|
* @public
|
|
42
41
|
* @type {boolean}
|
|
43
42
|
*/
|
|
44
|
-
this.visibility =
|
|
43
|
+
this.visibility = options.visibility != undefined ? options.visibility : true;
|
|
45
44
|
|
|
46
45
|
this.color = new Float32Array([1.0, 1.0, 1.0, 0.5]);
|
|
47
46
|
|
|
@@ -57,14 +56,14 @@ class Strip {
|
|
|
57
56
|
/**
|
|
58
57
|
* Parent collection render node.
|
|
59
58
|
* @private
|
|
60
|
-
* @type {
|
|
59
|
+
* @type {RenderNode}
|
|
61
60
|
*/
|
|
62
61
|
this._renderNode = null;
|
|
63
62
|
|
|
64
63
|
/**
|
|
65
64
|
* Entity instance that holds this strip.
|
|
66
65
|
* @private
|
|
67
|
-
* @type {
|
|
66
|
+
* @type {Entity}
|
|
68
67
|
*/
|
|
69
68
|
this._entity = null;
|
|
70
69
|
|
|
@@ -87,7 +86,7 @@ class Strip {
|
|
|
87
86
|
/**
|
|
88
87
|
* Handler that stores and renders this object.
|
|
89
88
|
* @private
|
|
90
|
-
* @type {
|
|
89
|
+
* @type {StripHandler}
|
|
91
90
|
*/
|
|
92
91
|
this._handler = null;
|
|
93
92
|
this._handlerIndex = -1;
|
|
@@ -111,7 +110,7 @@ class Strip {
|
|
|
111
110
|
/**
|
|
112
111
|
* Assign picking color.
|
|
113
112
|
* @protected
|
|
114
|
-
* @param {
|
|
113
|
+
* @param {Vec3} color - Picking RGB color.
|
|
115
114
|
*/
|
|
116
115
|
setPickingColor3v(color) {
|
|
117
116
|
this._pickingColor[0] = color.x / 255.0;
|
|
@@ -125,7 +124,6 @@ class Strip {
|
|
|
125
124
|
* @public
|
|
126
125
|
*/
|
|
127
126
|
clear() {
|
|
128
|
-
|
|
129
127
|
this._path.length = 0;
|
|
130
128
|
this._path = [];
|
|
131
129
|
|
|
@@ -177,7 +175,7 @@ class Strip {
|
|
|
177
175
|
/**
|
|
178
176
|
* Assign rendering scene node.
|
|
179
177
|
* @public
|
|
180
|
-
* @param {
|
|
178
|
+
* @param {RenderNode} renderNode - Assigned render node.
|
|
181
179
|
*/
|
|
182
180
|
setRenderNode(renderNode) {
|
|
183
181
|
this._renderNode = renderNode;
|
|
@@ -219,11 +217,30 @@ class Strip {
|
|
|
219
217
|
gl.uniform4fv(shu.uColor, this.color);
|
|
220
218
|
gl.uniform1f(shu.uOpacity, this._entity._entityCollection._fadingOpacity);
|
|
221
219
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesHighBuffer);
|
|
222
|
-
gl.vertexAttribPointer(
|
|
220
|
+
gl.vertexAttribPointer(
|
|
221
|
+
sha.aVertexPositionHigh,
|
|
222
|
+
this._verticesHighBuffer.itemSize,
|
|
223
|
+
gl.FLOAT,
|
|
224
|
+
false,
|
|
225
|
+
0,
|
|
226
|
+
0
|
|
227
|
+
);
|
|
223
228
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesLowBuffer);
|
|
224
|
-
gl.vertexAttribPointer(
|
|
229
|
+
gl.vertexAttribPointer(
|
|
230
|
+
sha.aVertexPositionLow,
|
|
231
|
+
this._verticesLowBuffer.itemSize,
|
|
232
|
+
gl.FLOAT,
|
|
233
|
+
false,
|
|
234
|
+
0,
|
|
235
|
+
0
|
|
236
|
+
);
|
|
225
237
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
226
|
-
gl.drawElements(
|
|
238
|
+
gl.drawElements(
|
|
239
|
+
r.handler.gl.TRIANGLE_STRIP,
|
|
240
|
+
this._indexBuffer.numItems,
|
|
241
|
+
gl.UNSIGNED_INT,
|
|
242
|
+
0
|
|
243
|
+
);
|
|
227
244
|
gl.enable(gl.CULL_FACE);
|
|
228
245
|
}
|
|
229
246
|
}
|
|
@@ -254,11 +271,30 @@ class Strip {
|
|
|
254
271
|
|
|
255
272
|
gl.uniform4fv(shu.uColor, this._pickingColor);
|
|
256
273
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesHighBuffer);
|
|
257
|
-
gl.vertexAttribPointer(
|
|
274
|
+
gl.vertexAttribPointer(
|
|
275
|
+
sha.aVertexPositionHigh,
|
|
276
|
+
this._verticesHighBuffer.itemSize,
|
|
277
|
+
gl.FLOAT,
|
|
278
|
+
false,
|
|
279
|
+
0,
|
|
280
|
+
0
|
|
281
|
+
);
|
|
258
282
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesLowBuffer);
|
|
259
|
-
gl.vertexAttribPointer(
|
|
283
|
+
gl.vertexAttribPointer(
|
|
284
|
+
sha.aVertexPositionLow,
|
|
285
|
+
this._verticesLowBuffer.itemSize,
|
|
286
|
+
gl.FLOAT,
|
|
287
|
+
false,
|
|
288
|
+
0,
|
|
289
|
+
0
|
|
290
|
+
);
|
|
260
291
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
261
|
-
gl.drawElements(
|
|
292
|
+
gl.drawElements(
|
|
293
|
+
r.handler.gl.TRIANGLE_STRIP,
|
|
294
|
+
this._indexBuffer.numItems,
|
|
295
|
+
gl.UNSIGNED_INT,
|
|
296
|
+
0
|
|
297
|
+
);
|
|
262
298
|
gl.enable(gl.CULL_FACE);
|
|
263
299
|
}
|
|
264
300
|
}
|
|
@@ -289,9 +325,21 @@ class Strip {
|
|
|
289
325
|
gl.deleteBuffer(this._verticesHighBuffer);
|
|
290
326
|
gl.deleteBuffer(this._verticesLowBuffer);
|
|
291
327
|
|
|
292
|
-
this._verticesHighBuffer = this._renderNode.renderer.handler.createArrayBuffer(
|
|
293
|
-
|
|
294
|
-
|
|
328
|
+
this._verticesHighBuffer = this._renderNode.renderer.handler.createArrayBuffer(
|
|
329
|
+
new Float32Array(this._verticesHigh),
|
|
330
|
+
3,
|
|
331
|
+
this._verticesHigh.length / 3
|
|
332
|
+
);
|
|
333
|
+
this._verticesLowBuffer = this._renderNode.renderer.handler.createArrayBuffer(
|
|
334
|
+
new Float32Array(this._verticesLow),
|
|
335
|
+
3,
|
|
336
|
+
this._verticesLow.length / 3
|
|
337
|
+
);
|
|
338
|
+
this._indexBuffer = this._renderNode.renderer.handler.createElementArrayBuffer(
|
|
339
|
+
new Uint32Array(this._indexes),
|
|
340
|
+
1,
|
|
341
|
+
this._indexes.length
|
|
342
|
+
);
|
|
295
343
|
}
|
|
296
344
|
}
|
|
297
345
|
|
|
@@ -299,11 +347,8 @@ class Strip {
|
|
|
299
347
|
let length = this._path.length;
|
|
300
348
|
|
|
301
349
|
if (length === 0) {
|
|
302
|
-
|
|
303
350
|
this._path.push([p2.clone(), p3.clone()]);
|
|
304
|
-
|
|
305
351
|
} else {
|
|
306
|
-
|
|
307
352
|
let p0 = this._path[length - 1][0],
|
|
308
353
|
p1 = this._path[length - 1][1];
|
|
309
354
|
|
|
@@ -323,19 +368,17 @@ class Strip {
|
|
|
323
368
|
let d = Math.abs(p0.sub(p1).normal().dot(p2.sub(p0).normal()));
|
|
324
369
|
|
|
325
370
|
for (let i = 0; i < gs1; i++) {
|
|
326
|
-
|
|
327
371
|
let di = i / gs;
|
|
328
372
|
let p02 = p0.lerp(p2, di),
|
|
329
373
|
p13 = p1.lerp(p3, di);
|
|
330
374
|
|
|
331
375
|
for (let j = 0; j < gs1; j++) {
|
|
332
|
-
|
|
333
376
|
let dj = j / gs;
|
|
334
377
|
let p01 = p0.lerp(p1, dj),
|
|
335
378
|
p23 = p2.lerp(p3, dj);
|
|
336
379
|
|
|
337
380
|
if (d !== 1.0) {
|
|
338
|
-
|
|
381
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
339
382
|
} else {
|
|
340
383
|
p = p23;
|
|
341
384
|
}
|
|
@@ -369,17 +412,15 @@ class Strip {
|
|
|
369
412
|
}
|
|
370
413
|
|
|
371
414
|
setEdge3v(p2, p3, index) {
|
|
372
|
-
|
|
373
415
|
if (index === this._path.length) {
|
|
374
416
|
this.addEdge3v(p2, p3);
|
|
375
417
|
return;
|
|
376
|
-
}
|
|
377
|
-
|
|
418
|
+
}
|
|
419
|
+
if (this._path[index]) {
|
|
378
420
|
this._path[index][0] = p2;
|
|
379
421
|
this._path[index][1] = p3;
|
|
380
422
|
|
|
381
423
|
if (this._path.length > 1) {
|
|
382
|
-
|
|
383
424
|
let gs = this._gridSize,
|
|
384
425
|
gs1 = gs + 1;
|
|
385
426
|
|
|
@@ -391,7 +432,6 @@ class Strip {
|
|
|
391
432
|
vLow = this._verticesLow;
|
|
392
433
|
|
|
393
434
|
if (index === this._path.length - 1) {
|
|
394
|
-
|
|
395
435
|
let p0 = this._path[index - 1][0],
|
|
396
436
|
p1 = this._path[index - 1][1];
|
|
397
437
|
|
|
@@ -401,19 +441,17 @@ class Strip {
|
|
|
401
441
|
let d = Math.abs(p0.sub(p1).normal().dot(p2.sub(p0).normal()));
|
|
402
442
|
|
|
403
443
|
for (let i = 0; i < gs1; i++) {
|
|
404
|
-
|
|
405
444
|
let di = i / gs;
|
|
406
445
|
let p02 = p0.lerp(p2, di),
|
|
407
446
|
p13 = p1.lerp(p3, di);
|
|
408
447
|
|
|
409
448
|
for (let j = 0; j < gs1; j++) {
|
|
410
|
-
|
|
411
449
|
let dj = j / gs;
|
|
412
450
|
let p01 = p0.lerp(p1, dj),
|
|
413
451
|
p23 = p2.lerp(p3, dj);
|
|
414
452
|
|
|
415
453
|
if (d !== 1.0) {
|
|
416
|
-
|
|
454
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
417
455
|
} else {
|
|
418
456
|
p = p23;
|
|
419
457
|
}
|
|
@@ -433,9 +471,7 @@ class Strip {
|
|
|
433
471
|
vLow[ind3 + 2] = _tempLow.z;
|
|
434
472
|
}
|
|
435
473
|
}
|
|
436
|
-
|
|
437
474
|
} else if (index === 0) {
|
|
438
|
-
|
|
439
475
|
let ind = 0;
|
|
440
476
|
|
|
441
477
|
let p0 = p2,
|
|
@@ -445,18 +481,16 @@ class Strip {
|
|
|
445
481
|
p3 = this._path[1][1];
|
|
446
482
|
|
|
447
483
|
for (let i = 0; i < gs1; i++) {
|
|
448
|
-
|
|
449
484
|
let di = i / gs;
|
|
450
485
|
let p02 = p0.lerp(p2, di),
|
|
451
486
|
p13 = p1.lerp(p3, di);
|
|
452
487
|
|
|
453
488
|
for (let j = 0; j < gs1; j++) {
|
|
454
|
-
|
|
455
489
|
let dj = j / gs;
|
|
456
490
|
let p01 = p0.lerp(p1, dj),
|
|
457
491
|
p23 = p2.lerp(p3, dj);
|
|
458
492
|
|
|
459
|
-
|
|
493
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
460
494
|
|
|
461
495
|
ind = i * gs1 + j;
|
|
462
496
|
|
|
@@ -474,7 +508,6 @@ class Strip {
|
|
|
474
508
|
}
|
|
475
509
|
}
|
|
476
510
|
} else if (index > 0 && index < this._path.length) {
|
|
477
|
-
|
|
478
511
|
let p0 = this._path[index - 1][0],
|
|
479
512
|
p1 = this._path[index - 1][1];
|
|
480
513
|
|
|
@@ -486,7 +519,6 @@ class Strip {
|
|
|
486
519
|
ind = prev;
|
|
487
520
|
|
|
488
521
|
for (let i = 0; i < gs1; i++) {
|
|
489
|
-
|
|
490
522
|
let di = i / gs;
|
|
491
523
|
let p02 = p0.lerp(p2, di),
|
|
492
524
|
p35 = p3.lerp(p5, di),
|
|
@@ -494,13 +526,12 @@ class Strip {
|
|
|
494
526
|
p13 = p1.lerp(p3, di);
|
|
495
527
|
|
|
496
528
|
for (let j = 0; j < gs1; j++) {
|
|
497
|
-
|
|
498
529
|
let dj = j / gs;
|
|
499
530
|
let p01 = p0.lerp(p1, dj),
|
|
500
531
|
p23 = p2.lerp(p3, dj);
|
|
501
532
|
|
|
502
533
|
// prev
|
|
503
|
-
|
|
534
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
504
535
|
|
|
505
536
|
let ij = i * gs1 + j;
|
|
506
537
|
|
|
@@ -523,7 +554,7 @@ class Strip {
|
|
|
523
554
|
|
|
524
555
|
p23 = p2.lerp(p3, dj);
|
|
525
556
|
|
|
526
|
-
|
|
557
|
+
new Line3(p24, p35).intersects(new Line3(p23, p45), p);
|
|
527
558
|
|
|
528
559
|
ind = next + ij;
|
|
529
560
|
|
|
@@ -564,14 +595,12 @@ class Strip {
|
|
|
564
595
|
}
|
|
565
596
|
|
|
566
597
|
setPath(path) {
|
|
567
|
-
|
|
568
598
|
this._verticesHigh = [];
|
|
569
599
|
this._verticesLow = [];
|
|
570
600
|
this._indexes = [];
|
|
571
601
|
this._path = [];
|
|
572
602
|
|
|
573
603
|
for (let i = 0; i < path.length; i++) {
|
|
574
|
-
|
|
575
604
|
let p0 = path[i][0],
|
|
576
605
|
p1 = path[i][1];
|
|
577
606
|
|
|
@@ -598,4 +627,4 @@ class Strip {
|
|
|
598
627
|
}
|
|
599
628
|
}
|
|
600
629
|
|
|
601
|
-
export { Strip };
|
|
630
|
+
export { Strip };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Program } from
|
|
3
|
+
import { Program } from "../webgl/Program.js";
|
|
4
4
|
|
|
5
5
|
class StripHandler {
|
|
6
6
|
constructor(entityCollection) {
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Picking rendering option.
|
|
10
9
|
* @public
|
|
@@ -15,21 +14,21 @@ class StripHandler {
|
|
|
15
14
|
/**
|
|
16
15
|
* Parent collection
|
|
17
16
|
* @private
|
|
18
|
-
* @type {
|
|
17
|
+
* @type {EntityCollection}
|
|
19
18
|
*/
|
|
20
19
|
this._entityCollection = entityCollection;
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Renderer
|
|
24
23
|
* @private
|
|
25
|
-
* @type {
|
|
24
|
+
* @type {Renderer}
|
|
26
25
|
*/
|
|
27
26
|
this._renderer = null;
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* Point cloud array
|
|
31
30
|
* @private
|
|
32
|
-
* @type {Array.<
|
|
31
|
+
* @type {Array.<Strip>}
|
|
33
32
|
*/
|
|
34
33
|
this._strips = [];
|
|
35
34
|
|
|
@@ -50,21 +49,21 @@ class StripHandler {
|
|
|
50
49
|
_initProgram() {
|
|
51
50
|
if (this._renderer.handler) {
|
|
52
51
|
!this._renderer.handler.programs.strip &&
|
|
53
|
-
this._renderer.handler.addProgram(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`attribute vec3 aVertexPositionHigh;
|
|
52
|
+
this._renderer.handler.addProgram(
|
|
53
|
+
new Program("strip", {
|
|
54
|
+
uniforms: {
|
|
55
|
+
projectionMatrix: { type: "mat4" },
|
|
56
|
+
viewMatrix: { type: "mat4" },
|
|
57
|
+
eyePositionHigh: "vec3",
|
|
58
|
+
eyePositionLow: "vec3",
|
|
59
|
+
uColor: { type: "vec4" },
|
|
60
|
+
uOpacity: { type: "float" }
|
|
61
|
+
},
|
|
62
|
+
attributes: {
|
|
63
|
+
aVertexPositionHigh: { type: "vec3" },
|
|
64
|
+
aVertexPositionLow: { type: "vec3" }
|
|
65
|
+
},
|
|
66
|
+
vertexShader: `attribute vec3 aVertexPositionHigh;
|
|
68
67
|
attribute vec3 aVertexPositionLow;
|
|
69
68
|
uniform mat4 projectionMatrix;
|
|
70
69
|
uniform mat4 viewMatrix;
|
|
@@ -80,14 +79,14 @@ class StripHandler {
|
|
|
80
79
|
|
|
81
80
|
gl_Position = projectionMatrix * viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
|
|
82
81
|
}`,
|
|
83
|
-
|
|
84
|
-
`precision highp float;
|
|
82
|
+
fragmentShader: `precision highp float;
|
|
85
83
|
uniform vec4 uColor;
|
|
86
84
|
uniform float uOpacity;
|
|
87
85
|
void main(void) {
|
|
88
86
|
gl_FragColor = vec4(uColor.rgb, uColor.a * uOpacity);
|
|
89
87
|
}`
|
|
90
|
-
|
|
88
|
+
})
|
|
89
|
+
);
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
|
|
@@ -104,7 +103,8 @@ class StripHandler {
|
|
|
104
103
|
strip._handler = this;
|
|
105
104
|
strip._handlerIndex = this._strips.length;
|
|
106
105
|
this._strips.push(strip);
|
|
107
|
-
this._entityCollection &&
|
|
106
|
+
this._entityCollection &&
|
|
107
|
+
this._entityCollection.renderNode &&
|
|
108
108
|
strip.setRenderNode(this._entityCollection.renderNode);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -155,4 +155,4 @@ class StripHandler {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
export { StripHandler };
|
|
158
|
+
export { StripHandler };
|
package/src/og/entity/index.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import { Entity } from
|
|
2
|
-
import { EntityCollection } from
|
|
3
|
-
import { Billboard } from
|
|
4
|
-
import { Geometry } from
|
|
5
|
-
import { Label } from
|
|
6
|
-
import { PointCloud } from
|
|
7
|
-
import { Polyline } from
|
|
1
|
+
import { Entity } from "./Entity.js";
|
|
2
|
+
import { EntityCollection } from "./EntityCollection.js";
|
|
3
|
+
import { Billboard } from "./Billboard.js";
|
|
4
|
+
import { Geometry } from "./Geometry.js";
|
|
5
|
+
import { Label } from "./Label.js";
|
|
6
|
+
import { PointCloud } from "./PointCloud.js";
|
|
7
|
+
import { Polyline } from "./Polyline.js";
|
|
8
8
|
|
|
9
|
-
export {
|
|
10
|
-
Entity,
|
|
11
|
-
EntityCollection,
|
|
12
|
-
Billboard,
|
|
13
|
-
Geometry,
|
|
14
|
-
Label,
|
|
15
|
-
PointCloud,
|
|
16
|
-
Polyline
|
|
17
|
-
};
|
|
9
|
+
export { Entity, EntityCollection, Billboard, Geometry, Label, PointCloud, Polyline };
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* @module og/layer/BaseGeoImage
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as mercator from
|
|
8
|
-
import { Extent } from
|
|
9
|
-
import { Layer } from
|
|
10
|
-
import { LonLat } from
|
|
7
|
+
import * as mercator from "../mercator.js";
|
|
8
|
+
import { Extent } from "../Extent.js";
|
|
9
|
+
import { Layer } from "./Layer.js";
|
|
10
|
+
import { LonLat } from "../LonLat.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* BaseGeoImage layer represents square imagery layer that could be an static image, or animated video or webgl buffer object displayed on the globe.
|
|
14
14
|
* @class
|
|
15
|
-
* @extends {
|
|
15
|
+
* @extends {Layer}
|
|
16
16
|
*/
|
|
17
17
|
class BaseGeoImage extends Layer {
|
|
18
18
|
constructor(name, options) {
|
|
@@ -58,8 +58,12 @@ class BaseGeoImage extends Layer {
|
|
|
58
58
|
*/
|
|
59
59
|
getCornersLonLat() {
|
|
60
60
|
var c = this._cornersWgs84;
|
|
61
|
-
return [
|
|
62
|
-
|
|
61
|
+
return [
|
|
62
|
+
new LonLat(c[0].lon, c[0].lat),
|
|
63
|
+
new LonLat(c[1].lon, c[1].lat),
|
|
64
|
+
new LonLat(c[2].lon, c[2].lat),
|
|
65
|
+
new LonLat(c[3].lon, c[3].lat)
|
|
66
|
+
];
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
/**
|
|
@@ -69,7 +73,12 @@ class BaseGeoImage extends Layer {
|
|
|
69
73
|
*/
|
|
70
74
|
getCorners() {
|
|
71
75
|
var c = this._cornersWgs84;
|
|
72
|
-
return [
|
|
76
|
+
return [
|
|
77
|
+
[c[0].lon, c[0].lat],
|
|
78
|
+
[c[1].lon, c[1].lat],
|
|
79
|
+
[c[2].lon, c[2].lat],
|
|
80
|
+
[c[3].lon, c[3].lat]
|
|
81
|
+
];
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
/**
|
|
@@ -92,7 +101,12 @@ class BaseGeoImage extends Layer {
|
|
|
92
101
|
*/
|
|
93
102
|
setCornersLonLat(corners) {
|
|
94
103
|
this._refreshFrame = true;
|
|
95
|
-
this._cornersWgs84 = [
|
|
104
|
+
this._cornersWgs84 = [
|
|
105
|
+
corners[0].clone(),
|
|
106
|
+
corners[1].clone(),
|
|
107
|
+
corners[2].clone(),
|
|
108
|
+
corners[3].clone()
|
|
109
|
+
] || [0, 0, 0, 0];
|
|
96
110
|
|
|
97
111
|
for (var i = 0; i < this._cornersWgs84.length; i++) {
|
|
98
112
|
if (this._cornersWgs84[i].lat >= 89.9) {
|
|
@@ -105,8 +119,7 @@ class BaseGeoImage extends Layer {
|
|
|
105
119
|
this._extent.setByCoordinates(this._cornersWgs84);
|
|
106
120
|
|
|
107
121
|
var me = this._extent;
|
|
108
|
-
if (me.southWest.lat > mercator.MAX_LAT ||
|
|
109
|
-
me.northEast.lat < mercator.MIN_LAT) {
|
|
122
|
+
if (me.southWest.lat > mercator.MAX_LAT || me.northEast.lat < mercator.MIN_LAT) {
|
|
110
123
|
this._projType = 0;
|
|
111
124
|
this.rendering = this._renderingProjType0;
|
|
112
125
|
} else {
|
|
@@ -126,15 +139,32 @@ class BaseGeoImage extends Layer {
|
|
|
126
139
|
_createFrame() {
|
|
127
140
|
this._extentWgs84 = this._extent.clone();
|
|
128
141
|
|
|
129
|
-
this._cornersMerc = [
|
|
130
|
-
|
|
142
|
+
this._cornersMerc = [
|
|
143
|
+
this._cornersWgs84[0].forwardMercatorEPS01(),
|
|
144
|
+
this._cornersWgs84[1].forwardMercatorEPS01(),
|
|
145
|
+
this._cornersWgs84[2].forwardMercatorEPS01(),
|
|
146
|
+
this._cornersWgs84[3].forwardMercatorEPS01()
|
|
147
|
+
];
|
|
131
148
|
|
|
132
|
-
this._extentMerc = new Extent(
|
|
149
|
+
this._extentMerc = new Extent(
|
|
150
|
+
this._extentWgs84.southWest.forwardMercatorEPS01(),
|
|
151
|
+
this._extentWgs84.northEast.forwardMercatorEPS01()
|
|
152
|
+
);
|
|
133
153
|
|
|
134
154
|
if (this._projType === 0) {
|
|
135
|
-
this._extentWgs84Params = [
|
|
155
|
+
this._extentWgs84Params = [
|
|
156
|
+
this._extentWgs84.southWest.lon,
|
|
157
|
+
this._extentWgs84.southWest.lat,
|
|
158
|
+
2.0 / this._extentWgs84.getWidth(),
|
|
159
|
+
2.0 / this._extentWgs84.getHeight()
|
|
160
|
+
];
|
|
136
161
|
} else {
|
|
137
|
-
this._extentMercParams = [
|
|
162
|
+
this._extentMercParams = [
|
|
163
|
+
this._extentMerc.southWest.lon,
|
|
164
|
+
this._extentMerc.southWest.lat,
|
|
165
|
+
2.0 / this._extentMerc.getWidth(),
|
|
166
|
+
2.0 / this._extentMerc.getHeight()
|
|
167
|
+
];
|
|
138
168
|
}
|
|
139
169
|
|
|
140
170
|
// creates material frame textures
|
|
@@ -146,7 +176,10 @@ class BaseGeoImage extends Layer {
|
|
|
146
176
|
gl.deleteTexture(this._materialTexture);
|
|
147
177
|
this._materialTexture = h.createEmptyTexture_l(this._frameWidth, this._frameHeight);
|
|
148
178
|
|
|
149
|
-
this._gridBuffer = this._planet._geoImageCreator.createGridBuffer(
|
|
179
|
+
this._gridBuffer = this._planet._geoImageCreator.createGridBuffer(
|
|
180
|
+
this._cornersWgs84,
|
|
181
|
+
this._projType
|
|
182
|
+
);
|
|
150
183
|
|
|
151
184
|
this._refreshFrame = false;
|
|
152
185
|
}
|
|
@@ -154,7 +187,7 @@ class BaseGeoImage extends Layer {
|
|
|
154
187
|
|
|
155
188
|
/**
|
|
156
189
|
* @virtual
|
|
157
|
-
* @param {
|
|
190
|
+
* @param {Material} material - GeoImage material.
|
|
158
191
|
*/
|
|
159
192
|
abortMaterialLoading(material) {
|
|
160
193
|
this._creationProceeding = false;
|
|
@@ -200,7 +233,6 @@ class BaseGeoImage extends Layer {
|
|
|
200
233
|
*/
|
|
201
234
|
setVisibility(visibility) {
|
|
202
235
|
if (visibility !== this._visibility) {
|
|
203
|
-
|
|
204
236
|
super.setVisibility(visibility);
|
|
205
237
|
|
|
206
238
|
// remove from creator
|
|
@@ -215,7 +247,7 @@ class BaseGeoImage extends Layer {
|
|
|
215
247
|
/**
|
|
216
248
|
* @virtual
|
|
217
249
|
* @protected
|
|
218
|
-
* @param {
|
|
250
|
+
* @param {Material} material - GeoImage material.
|
|
219
251
|
*/
|
|
220
252
|
clearMaterial(material) {
|
|
221
253
|
material.image = null;
|
|
@@ -227,11 +259,10 @@ class BaseGeoImage extends Layer {
|
|
|
227
259
|
/**
|
|
228
260
|
* @virtual
|
|
229
261
|
* @protected
|
|
230
|
-
* @param {
|
|
262
|
+
* @param {Material} material - GeoImage material.
|
|
231
263
|
* @returns {Array<number> } -
|
|
232
264
|
*/
|
|
233
265
|
applyMaterial(material) {
|
|
234
|
-
|
|
235
266
|
var segment = material.segment;
|
|
236
267
|
|
|
237
268
|
if (this._ready) {
|