@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
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @module og/entity/PointCloud
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Vec3 } from
|
|
8
|
-
import { Vec4 } from
|
|
7
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
8
|
+
import { Vec4 } from "../math/Vec4.js";
|
|
9
9
|
|
|
10
10
|
const COORDINATES_BUFFER = 0;
|
|
11
11
|
const COLOR_BUFFER = 1;
|
|
@@ -15,7 +15,7 @@ const PICKING_COLOR_BUFFER = 2;
|
|
|
15
15
|
* PointCloud object.
|
|
16
16
|
* @class
|
|
17
17
|
* @param {*} [options] - Point cloud options:
|
|
18
|
-
* @param {Array.<Array.<number
|
|
18
|
+
* @param {Array.<Array.<number>>} [options.points] - Points cartesian coordinates array,
|
|
19
19
|
* where first three is cartesian coordinates, next fourth is a RGBA color, and last is an point properties.
|
|
20
20
|
* @param {number} [options.pointSize] - Point screen size in pixels.
|
|
21
21
|
* @param {number} [options.pickingDistance] - Point border picking size in screen pixels.
|
|
@@ -33,7 +33,6 @@ const PICKING_COLOR_BUFFER = 2;
|
|
|
33
33
|
*/
|
|
34
34
|
class PointCloud {
|
|
35
35
|
constructor(options) {
|
|
36
|
-
|
|
37
36
|
options = options || {};
|
|
38
37
|
|
|
39
38
|
/**
|
|
@@ -49,7 +48,7 @@ class PointCloud {
|
|
|
49
48
|
* @public
|
|
50
49
|
* @type {boolean}
|
|
51
50
|
*/
|
|
52
|
-
this.visibility =
|
|
51
|
+
this.visibility = options.visibility != undefined ? options.visibility : true;
|
|
53
52
|
|
|
54
53
|
/**
|
|
55
54
|
* Point screen size in pixels.
|
|
@@ -68,14 +67,14 @@ class PointCloud {
|
|
|
68
67
|
/**
|
|
69
68
|
* Parent collection render node.
|
|
70
69
|
* @private
|
|
71
|
-
* @type {
|
|
70
|
+
* @type {RenderNode}
|
|
72
71
|
*/
|
|
73
72
|
this._renderNode = null;
|
|
74
73
|
|
|
75
74
|
/**
|
|
76
75
|
* Entity instance that holds this point cloud.
|
|
77
76
|
* @private
|
|
78
|
-
* @type {
|
|
77
|
+
* @type {Entity}
|
|
79
78
|
*/
|
|
80
79
|
this._entity = null;
|
|
81
80
|
|
|
@@ -114,7 +113,7 @@ class PointCloud {
|
|
|
114
113
|
/**
|
|
115
114
|
* Handler that stores and renders this object.
|
|
116
115
|
* @private
|
|
117
|
-
* @type {
|
|
116
|
+
* @type {PointCloudHandler}
|
|
118
117
|
*/
|
|
119
118
|
this._handler = null;
|
|
120
119
|
this._handlerIndex = -1;
|
|
@@ -145,7 +144,6 @@ class PointCloud {
|
|
|
145
144
|
* @public
|
|
146
145
|
*/
|
|
147
146
|
clear() {
|
|
148
|
-
|
|
149
147
|
this._points.length = 0;
|
|
150
148
|
this._points = [];
|
|
151
149
|
|
|
@@ -189,7 +187,7 @@ class PointCloud {
|
|
|
189
187
|
/**
|
|
190
188
|
* Assign rendering scene node.
|
|
191
189
|
* @public
|
|
192
|
-
* @param {
|
|
190
|
+
* @param {RenderNode} renderNode - Assigned render node.
|
|
193
191
|
*/
|
|
194
192
|
setRenderNode(renderNode) {
|
|
195
193
|
this._renderNode = renderNode;
|
|
@@ -208,7 +206,7 @@ class PointCloud {
|
|
|
208
206
|
/**
|
|
209
207
|
* Adds points to render.
|
|
210
208
|
* @public
|
|
211
|
-
* @param {Array.<Array<number
|
|
209
|
+
* @param {Array.<Array<number>>} points - Point cloud array.
|
|
212
210
|
* @example
|
|
213
211
|
* var points = [[0, 0, 0, 255, 255, 255, 255, { 'name': 'White point' }], [100, 100, 0, 255, 0, 0, 255, { 'name': 'Red point' }]];
|
|
214
212
|
*/
|
|
@@ -217,7 +215,7 @@ class PointCloud {
|
|
|
217
215
|
for (var i = 0; i < points.length; i++) {
|
|
218
216
|
var pi = points[i];
|
|
219
217
|
var pos = new Vec3(pi[0], pi[1], pi[2]),
|
|
220
|
-
col = new Vec4(pi[3], pi[4], pi[5],
|
|
218
|
+
col = new Vec4(pi[3], pi[4], pi[5], pi[6] == undefined ? 255.0 : pi[6]);
|
|
221
219
|
this._coordinatesData.push(pos.x, pos.y, pos.z);
|
|
222
220
|
this._colorData.push(col.x / 255.0, col.y / 255.0, col.z / 255.0, col.w / 255.0);
|
|
223
221
|
var p = {
|
|
@@ -233,7 +231,12 @@ class PointCloud {
|
|
|
233
231
|
|
|
234
232
|
if (this._renderNode) {
|
|
235
233
|
this._renderNode.renderer.assignPickingColor(p);
|
|
236
|
-
this._pickingColorData.push(
|
|
234
|
+
this._pickingColorData.push(
|
|
235
|
+
p._pickingColor.x / 255.0,
|
|
236
|
+
p._pickingColor.y / 255.0,
|
|
237
|
+
p._pickingColor.z / 255.0,
|
|
238
|
+
1.0
|
|
239
|
+
);
|
|
237
240
|
}
|
|
238
241
|
}
|
|
239
242
|
|
|
@@ -243,21 +246,18 @@ class PointCloud {
|
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
setPointPosition(index, x, y, z) {
|
|
246
|
-
|
|
247
249
|
// TODO: ...
|
|
248
250
|
|
|
249
251
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
setPointColor(index, r, g, b, a) {
|
|
253
|
-
|
|
254
255
|
// TODO: ...
|
|
255
256
|
|
|
256
257
|
this._changedBuffers[COLOR_BUFFER] = true;
|
|
257
258
|
}
|
|
258
259
|
|
|
259
260
|
addPoints(points) {
|
|
260
|
-
|
|
261
261
|
// TODO: ...
|
|
262
262
|
|
|
263
263
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
@@ -266,7 +266,6 @@ class PointCloud {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
addPoint(index, point) {
|
|
269
|
-
|
|
270
269
|
// TODO: ...
|
|
271
270
|
|
|
272
271
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
@@ -285,7 +284,6 @@ class PointCloud {
|
|
|
285
284
|
}
|
|
286
285
|
|
|
287
286
|
removePoint(index) {
|
|
288
|
-
|
|
289
287
|
// TODO: ...
|
|
290
288
|
|
|
291
289
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
@@ -294,7 +292,6 @@ class PointCloud {
|
|
|
294
292
|
}
|
|
295
293
|
|
|
296
294
|
insertPoint(index, point) {
|
|
297
|
-
|
|
298
295
|
// TODO: ...
|
|
299
296
|
|
|
300
297
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
@@ -316,7 +313,6 @@ class PointCloud {
|
|
|
316
313
|
|
|
317
314
|
draw() {
|
|
318
315
|
if (this.visibility && this._coordinatesData.length) {
|
|
319
|
-
|
|
320
316
|
this._update();
|
|
321
317
|
|
|
322
318
|
var rn = this._renderNode;
|
|
@@ -327,18 +323,32 @@ class PointCloud {
|
|
|
327
323
|
sha = p.attributes,
|
|
328
324
|
shu = p.uniforms;
|
|
329
325
|
|
|
330
|
-
gl.polygonOffset(
|
|
326
|
+
gl.polygonOffset(
|
|
327
|
+
this._handler._entityCollection.polygonOffsetFactor,
|
|
328
|
+
this._handler._entityCollection.polygonOffsetUnits
|
|
329
|
+
);
|
|
331
330
|
|
|
332
331
|
sh.activate();
|
|
333
332
|
|
|
334
|
-
gl.uniformMatrix4fv(
|
|
333
|
+
gl.uniformMatrix4fv(
|
|
334
|
+
shu.projectionViewMatrix,
|
|
335
|
+
false,
|
|
336
|
+
r.activeCamera._projectionViewMatrix._m
|
|
337
|
+
);
|
|
335
338
|
|
|
336
339
|
gl.uniform1f(shu.opacity, this._handler._entityCollection._fadingOpacity);
|
|
337
340
|
|
|
338
341
|
gl.uniform1f(shu.pointSize, this.pointSize);
|
|
339
342
|
|
|
340
343
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._coordinatesBuffer);
|
|
341
|
-
gl.vertexAttribPointer(
|
|
344
|
+
gl.vertexAttribPointer(
|
|
345
|
+
sha.coordinates,
|
|
346
|
+
this._coordinatesBuffer.itemSize,
|
|
347
|
+
gl.FLOAT,
|
|
348
|
+
false,
|
|
349
|
+
0,
|
|
350
|
+
0
|
|
351
|
+
);
|
|
342
352
|
|
|
343
353
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._colorBuffer);
|
|
344
354
|
gl.vertexAttribPointer(sha.colors, this._colorBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
@@ -359,19 +369,40 @@ class PointCloud {
|
|
|
359
369
|
|
|
360
370
|
sh.activate();
|
|
361
371
|
|
|
362
|
-
gl.polygonOffset(
|
|
372
|
+
gl.polygonOffset(
|
|
373
|
+
this._handler._entityCollection.polygonOffsetFactor,
|
|
374
|
+
this._handler._entityCollection.polygonOffsetUnits
|
|
375
|
+
);
|
|
363
376
|
|
|
364
|
-
gl.uniformMatrix4fv(
|
|
377
|
+
gl.uniformMatrix4fv(
|
|
378
|
+
shu.projectionViewMatrix,
|
|
379
|
+
false,
|
|
380
|
+
r.activeCamera._projectionViewMatrix._m
|
|
381
|
+
);
|
|
365
382
|
|
|
366
383
|
gl.uniform1f(shu.opacity, this._handler._entityCollection._fadingOpacity);
|
|
367
384
|
|
|
368
385
|
gl.uniform1f(shu.pointSize, this.pointSize + this.pickingDistance);
|
|
369
386
|
|
|
370
387
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._coordinatesBuffer);
|
|
371
|
-
gl.vertexAttribPointer(
|
|
388
|
+
gl.vertexAttribPointer(
|
|
389
|
+
sha.coordinates,
|
|
390
|
+
this._coordinatesBuffer.itemSize,
|
|
391
|
+
gl.FLOAT,
|
|
392
|
+
false,
|
|
393
|
+
0,
|
|
394
|
+
0
|
|
395
|
+
);
|
|
372
396
|
|
|
373
397
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._pickingColorBuffer);
|
|
374
|
-
gl.vertexAttribPointer(
|
|
398
|
+
gl.vertexAttribPointer(
|
|
399
|
+
sha.colors,
|
|
400
|
+
this._pickingColorBuffer.itemSize,
|
|
401
|
+
gl.FLOAT,
|
|
402
|
+
false,
|
|
403
|
+
0,
|
|
404
|
+
0
|
|
405
|
+
);
|
|
375
406
|
|
|
376
407
|
gl.drawArrays(gl.POINTS, 0, this._coordinatesBuffer.numItems);
|
|
377
408
|
}
|
|
@@ -415,19 +446,31 @@ class PointCloud {
|
|
|
415
446
|
_createCoordinatesBuffer() {
|
|
416
447
|
var h = this._renderNode.renderer.handler;
|
|
417
448
|
h.gl.deleteBuffer(this._coordinatesBuffer);
|
|
418
|
-
this._coordinatesBuffer = h.createArrayBuffer(
|
|
449
|
+
this._coordinatesBuffer = h.createArrayBuffer(
|
|
450
|
+
new Float32Array(this._coordinatesData),
|
|
451
|
+
3,
|
|
452
|
+
this._coordinatesData.length / 3
|
|
453
|
+
);
|
|
419
454
|
}
|
|
420
455
|
|
|
421
456
|
_createColorBuffer() {
|
|
422
457
|
var h = this._renderNode.renderer.handler;
|
|
423
458
|
h.gl.deleteBuffer(this._colorBuffer);
|
|
424
|
-
this._colorBuffer = h.createArrayBuffer(
|
|
459
|
+
this._colorBuffer = h.createArrayBuffer(
|
|
460
|
+
new Float32Array(this._colorData),
|
|
461
|
+
4,
|
|
462
|
+
this._colorData.length / 4
|
|
463
|
+
);
|
|
425
464
|
}
|
|
426
465
|
|
|
427
466
|
_createPickingColorBuffer() {
|
|
428
467
|
var h = this._renderNode.renderer.handler;
|
|
429
468
|
h.gl.deleteBuffer(this._pickingColorBuffer);
|
|
430
|
-
this._pickingColorBuffer = h.createArrayBuffer(
|
|
469
|
+
this._pickingColorBuffer = h.createArrayBuffer(
|
|
470
|
+
new Float32Array(this._pickingColorData),
|
|
471
|
+
4,
|
|
472
|
+
this._pickingColorData.length / 4
|
|
473
|
+
);
|
|
431
474
|
}
|
|
432
475
|
|
|
433
476
|
_setPickingColors() {
|
|
@@ -437,11 +480,16 @@ class PointCloud {
|
|
|
437
480
|
p._entity = this._entity;
|
|
438
481
|
p._entityCollection = this._entity._entityCollection;
|
|
439
482
|
this._renderNode.renderer.assignPickingColor(p);
|
|
440
|
-
this._pickingColorData.push(
|
|
483
|
+
this._pickingColorData.push(
|
|
484
|
+
p._pickingColor.x / 255.0,
|
|
485
|
+
p._pickingColor.y / 255.0,
|
|
486
|
+
p._pickingColor.z / 255.0,
|
|
487
|
+
1.0
|
|
488
|
+
);
|
|
441
489
|
}
|
|
442
490
|
this._changedBuffers[PICKING_COLOR_BUFFER] = true;
|
|
443
491
|
}
|
|
444
492
|
}
|
|
445
493
|
}
|
|
446
494
|
|
|
447
|
-
export { PointCloud };
|
|
495
|
+
export { PointCloud };
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* @module og/entity/PointCloudHandler
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as shaders from
|
|
7
|
+
import * as shaders from "../shaders/pointCloud.js";
|
|
8
8
|
|
|
9
9
|
class PointCloudHandler {
|
|
10
10
|
constructor(entityCollection) {
|
|
11
|
-
|
|
12
11
|
/**
|
|
13
12
|
* Picking rendering option.
|
|
14
13
|
* @public
|
|
@@ -19,21 +18,21 @@ class PointCloudHandler {
|
|
|
19
18
|
/**
|
|
20
19
|
* Parent collection
|
|
21
20
|
* @private
|
|
22
|
-
* @type {
|
|
21
|
+
* @type {EntityCollection}
|
|
23
22
|
*/
|
|
24
23
|
this._entityCollection = entityCollection;
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
* Renderer
|
|
28
27
|
* @private
|
|
29
|
-
* @type {
|
|
28
|
+
* @type {Renderer}
|
|
30
29
|
*/
|
|
31
30
|
this._renderer = null;
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
33
|
* Point cloud array
|
|
35
34
|
* @private
|
|
36
|
-
* @type {Array.<
|
|
35
|
+
* @type {Array.<PointCloud>}
|
|
37
36
|
*/
|
|
38
37
|
this._pointClouds = [];
|
|
39
38
|
|
|
@@ -72,7 +71,8 @@ class PointCloudHandler {
|
|
|
72
71
|
pointCloud._handler = this;
|
|
73
72
|
pointCloud._handlerIndex = this._pointClouds.length;
|
|
74
73
|
this._pointClouds.push(pointCloud);
|
|
75
|
-
this._entityCollection &&
|
|
74
|
+
this._entityCollection &&
|
|
75
|
+
this._entityCollection.renderNode &&
|
|
76
76
|
pointCloud.setRenderNode(this._entityCollection.renderNode);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -121,6 +121,6 @@ class PointCloudHandler {
|
|
|
121
121
|
this._pointClouds.length = 0;
|
|
122
122
|
this._pointClouds = [];
|
|
123
123
|
}
|
|
124
|
-
}
|
|
124
|
+
}
|
|
125
125
|
|
|
126
|
-
export { PointCloudHandler };
|
|
126
|
+
export { PointCloudHandler };
|
|
@@ -32,13 +32,13 @@ const A = 3;
|
|
|
32
32
|
* @param {Object} [options] - Polyline options:
|
|
33
33
|
* @param {number} [options.thickness] - Thickness in screen pixels 1.5 is default.
|
|
34
34
|
* @param {Number} [options.altitude] - Relative to ground layers altitude value.
|
|
35
|
-
* @param {
|
|
35
|
+
* @param {Vec4} [options.color] - RGBA color.
|
|
36
36
|
* @param {Boolean} [options.opacity] - Line opacity.
|
|
37
37
|
* @param {Boolean} [options.visibility] - Polyline visibility. True default.
|
|
38
38
|
* @param {Boolean} [options.isClosed] - Closed geometry type identificator.
|
|
39
|
-
* @param {Array.<Array.<number
|
|
40
|
-
* @param {Array.<Array.<number
|
|
41
|
-
* @param {Array.<Array.<number
|
|
39
|
+
* @param {Array.<Array.<number>>} [options.pathLonLat] - Polyline geodetic coordinates array. [[0,0,0], [1,1,1],...]
|
|
40
|
+
* @param {Array.<Array.<number>>} [options.path3v] - LinesString cartesian coordinates array. [[0,0,0], [1,1,1],...]
|
|
41
|
+
* @param {Array.<Array.<number>>} [options.pathColors] - Coordinates color. [[1,0,0,1], [0,1,0,1],...] for right and green colors.
|
|
42
42
|
*/
|
|
43
43
|
class Polyline {
|
|
44
44
|
constructor(options) {
|
|
@@ -64,7 +64,7 @@ class Polyline {
|
|
|
64
64
|
/**
|
|
65
65
|
* Polyline RGBA color.
|
|
66
66
|
* @public
|
|
67
|
-
* @type {Array<
|
|
67
|
+
* @type {Array<number>} - (exactly 4 entries)
|
|
68
68
|
*/
|
|
69
69
|
this._defaultColor = htmlColorToFloat32Array(
|
|
70
70
|
options.color || DEFAULT_COLOR,
|
|
@@ -88,7 +88,7 @@ class Polyline {
|
|
|
88
88
|
/**
|
|
89
89
|
* Polyline cartesian coordinates.
|
|
90
90
|
* @private
|
|
91
|
-
* @type {Array.<
|
|
91
|
+
* @type {Array.<Vec3>}
|
|
92
92
|
*/
|
|
93
93
|
this._path3v = [];
|
|
94
94
|
|
|
@@ -97,14 +97,14 @@ class Polyline {
|
|
|
97
97
|
/**
|
|
98
98
|
* Polyline geodetic degrees coordiantes.
|
|
99
99
|
* @private
|
|
100
|
-
* @type {Array.<
|
|
100
|
+
* @type {Array.<LonLat>}
|
|
101
101
|
*/
|
|
102
102
|
this._pathLonLat = [];
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Polyline geodetic mercator coordinates.
|
|
106
106
|
* @private
|
|
107
|
-
* @type {Array.<
|
|
107
|
+
* @type {Array.<LonLat>}
|
|
108
108
|
*/
|
|
109
109
|
this._pathLonLatMerc = [];
|
|
110
110
|
|
|
@@ -113,7 +113,7 @@ class Polyline {
|
|
|
113
113
|
/**
|
|
114
114
|
* Polyline geodetic extent.
|
|
115
115
|
* @protected
|
|
116
|
-
* @type {
|
|
116
|
+
* @type {Extent}
|
|
117
117
|
*/
|
|
118
118
|
this._extent = new Extent();
|
|
119
119
|
|
|
@@ -136,14 +136,14 @@ class Polyline {
|
|
|
136
136
|
/**
|
|
137
137
|
* Entity instance that holds this Polyline.
|
|
138
138
|
* @private
|
|
139
|
-
* @type {
|
|
139
|
+
* @type {Entity}
|
|
140
140
|
*/
|
|
141
141
|
this._entity = null;
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
144
|
* Handler that stores and renders this Polyline object.
|
|
145
145
|
* @private
|
|
146
|
-
* @type {
|
|
146
|
+
* @type {PolylineHandler}
|
|
147
147
|
*/
|
|
148
148
|
this._handler = null;
|
|
149
149
|
this._handlerIndex = -1;
|
|
@@ -178,16 +178,16 @@ class Polyline {
|
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
* Appends to the line array new cartesian coordinates line data.
|
|
181
|
-
* @param {Array.<Array.<number
|
|
181
|
+
* @param {Array.<Array.<number>>} path3v - Line coordinates path array. [[0,0,0], [1,1,1],...]
|
|
182
182
|
* @param {Boolean} isClosed - Identificator for the closed line data creation.
|
|
183
183
|
* @param {Number[]} outVertices - Out vertices data array.
|
|
184
184
|
* @param {Number[]} outOrders - Out vertices orders data array.
|
|
185
185
|
* @param {Number[]} outIndexes - Out vertices indexes data array.
|
|
186
|
-
* @param {
|
|
187
|
-
* @param {Array.<Array.<
|
|
188
|
-
* @param {Array.<Array.<
|
|
189
|
-
* @param {Array.<Array.<
|
|
190
|
-
* @param {
|
|
186
|
+
* @param {Ellipsoid} [ellipsoid] - Ellipsoid to coordinates transformation.
|
|
187
|
+
* @param {Array.<Array.<LonLat>>} [outTransformedPathLonLat] - Geodetic coordinates out array.
|
|
188
|
+
* @param {Array.<Array.<LonLat>>} [outPath3v] - Cartesian coordinates out array.
|
|
189
|
+
* @param {Array.<Array.<LonLat>>} [outTransformedPathMerc] - Mercator coordinates out array.
|
|
190
|
+
* @param {Extent} [outExtent] - Geodetic line extent.
|
|
191
191
|
* @param {Array} [outColors]
|
|
192
192
|
* @static
|
|
193
193
|
*/
|
|
@@ -449,16 +449,16 @@ class Polyline {
|
|
|
449
449
|
|
|
450
450
|
/**
|
|
451
451
|
* Appends to the line new cartesian coordinates point data.
|
|
452
|
-
* @param {Array.<Array.<number
|
|
452
|
+
* @param {Array.<Array.<number>>} path3v - Line coordinates path array. [[0,0,0], [1,1,1],...]
|
|
453
453
|
* @param {Boolean} isClosed - Identificator for the closed line data creation.
|
|
454
454
|
* @param {Number[]} outVertices - Out vertices data array.
|
|
455
455
|
* @param {Number[]} outOrders - Out vertices orders data array.
|
|
456
456
|
* @param {Number[]} outIndexes - Out vertices indexes data array.
|
|
457
|
-
* @param {
|
|
458
|
-
* @param {Array.<Array.<
|
|
459
|
-
* @param {Array.<Array.<
|
|
460
|
-
* @param {Array.<Array.<
|
|
461
|
-
* @param {
|
|
457
|
+
* @param {Ellipsoid} [ellipsoid] - Ellipsoid to coordinates transformation.
|
|
458
|
+
* @param {Array.<Array.<LonLat>>} [outTransformedPathLonLat] - Geodetic coordinates out array.
|
|
459
|
+
* @param {Array.<Array.<LonLat>>} [outPath3v] - Cartesian coordinates out array.
|
|
460
|
+
* @param {Array.<Array.<LonLat>>} [outTransformedPathMerc] - Mercator coordinates out array.
|
|
461
|
+
* @param {Extent} [outExtent] - Geodetic line extent.
|
|
462
462
|
* @static
|
|
463
463
|
*/
|
|
464
464
|
static appendPoint3v(
|
|
@@ -701,16 +701,16 @@ class Polyline {
|
|
|
701
701
|
|
|
702
702
|
/**
|
|
703
703
|
* Appends to the line array new geodetic coordinates line data.
|
|
704
|
-
* @param {Array.<Array.<number
|
|
704
|
+
* @param {Array.<Array.<number>>} pathLonLat - Line geodetic coordinates path array. [[0,0,0], [1,1,1],...]
|
|
705
705
|
* @param {Boolean} isClosed - Identificator for the closed line data creation.
|
|
706
706
|
* @param {Number[]} outVertices - Out vertices data array.
|
|
707
707
|
* @param {Number[]} outOrders - Out vertices orders data array.
|
|
708
708
|
* @param {Number[]} outIndexes - Out indexes data array.
|
|
709
|
-
* @param {
|
|
710
|
-
* @param {Array.<Array.<
|
|
711
|
-
* @param {Array.<Array.<
|
|
712
|
-
* @param {Array.<Array.<
|
|
713
|
-
* @param {
|
|
709
|
+
* @param {Ellipsoid} ellipsoid - Ellipsoid to coordinates transformation.
|
|
710
|
+
* @param {Array.<Array.<number>>} outTransformedPathCartesian - Cartesian coordinates out array. [[0,0,0], [1,1,1],...]
|
|
711
|
+
* @param {Array.<Array.<LonLat>>} outPathLonLat - Geographic coordinates out array.
|
|
712
|
+
* @param {Array.<Array.<LonLat>>} outTransformedPathMerc - Mercator coordinates out array.
|
|
713
|
+
* @param {Extent} outExtent - Geodetic line extent.
|
|
714
714
|
* @static
|
|
715
715
|
*/
|
|
716
716
|
static appendLineDataLonLat(
|
|
@@ -1157,7 +1157,7 @@ class Polyline {
|
|
|
1157
1157
|
/**
|
|
1158
1158
|
* Sets polyline with geodetic coordinates.
|
|
1159
1159
|
* @protected
|
|
1160
|
-
* @param {
|
|
1160
|
+
* @param {LonLat[]} pathLonLat - Geodetic polyline path coordinates.
|
|
1161
1161
|
*/
|
|
1162
1162
|
_setEqualPathLonLat(pathLonLat) {
|
|
1163
1163
|
var extent = this._extent;
|
|
@@ -1579,7 +1579,7 @@ class Polyline {
|
|
|
1579
1579
|
/**
|
|
1580
1580
|
* Adds a new cartesian point in the end of the path in a last line segment.
|
|
1581
1581
|
* @public
|
|
1582
|
-
* @param {
|
|
1582
|
+
* @param {Vec3} point3v - New coordinate.
|
|
1583
1583
|
*/
|
|
1584
1584
|
appendPoint3v(point3v, color, skipEllipsoid) {
|
|
1585
1585
|
if (this._path3v.length === 0) {
|
|
@@ -1623,7 +1623,7 @@ class Polyline {
|
|
|
1623
1623
|
/**
|
|
1624
1624
|
* Adds a new cartesian point in the end of the path.
|
|
1625
1625
|
* @public
|
|
1626
|
-
* @param {
|
|
1626
|
+
* @param {Vec3} point3v - New coordinate.
|
|
1627
1627
|
* @param {number} [multiLineIndex=0] - Path part index, first by default.
|
|
1628
1628
|
*/
|
|
1629
1629
|
addPoint3v(point3v, multiLineIndex = 0) {
|
|
@@ -1640,7 +1640,7 @@ class Polyline {
|
|
|
1640
1640
|
/**
|
|
1641
1641
|
* Adds a new geodetic point in the end of the path.
|
|
1642
1642
|
* @public
|
|
1643
|
-
* @param {
|
|
1643
|
+
* @param {LonLat} lonLat - New coordinate.
|
|
1644
1644
|
* @param {number} [multiLineIndex=0] - Path part index, first by default.
|
|
1645
1645
|
*/
|
|
1646
1646
|
addPointLonLat(lonLat, multiLineIndex = 0) {
|
|
@@ -1752,7 +1752,7 @@ class Polyline {
|
|
|
1752
1752
|
/**
|
|
1753
1753
|
* Assign with render node.
|
|
1754
1754
|
* @public
|
|
1755
|
-
* @param {
|
|
1755
|
+
* @param {RenderNode} renderNode -
|
|
1756
1756
|
*/
|
|
1757
1757
|
setRenderNode(renderNode) {
|
|
1758
1758
|
if (renderNode) {
|
|
@@ -1870,7 +1870,7 @@ class Polyline {
|
|
|
1870
1870
|
/**
|
|
1871
1871
|
* Returns polyline geodetic extent.
|
|
1872
1872
|
* @public
|
|
1873
|
-
* @returns {
|
|
1873
|
+
* @returns {Extent} - Geodetic extent
|
|
1874
1874
|
*/
|
|
1875
1875
|
getExtent() {
|
|
1876
1876
|
return this._extent.clone();
|
|
@@ -1878,7 +1878,7 @@ class Polyline {
|
|
|
1878
1878
|
|
|
1879
1879
|
/**
|
|
1880
1880
|
* Returns path cartesian coordinates.
|
|
1881
|
-
* @return {Array.<
|
|
1881
|
+
* @return {Array.<Vec3>} Polyline path.
|
|
1882
1882
|
*/
|
|
1883
1883
|
getPath3v() {
|
|
1884
1884
|
return this._path3v;
|
|
@@ -1886,7 +1886,7 @@ class Polyline {
|
|
|
1886
1886
|
|
|
1887
1887
|
/**
|
|
1888
1888
|
* Returns geodetic path coordinates.
|
|
1889
|
-
* @return {Array.<
|
|
1889
|
+
* @return {Array.<LonLat>} Polyline path.
|
|
1890
1890
|
*/
|
|
1891
1891
|
getPathLonLat() {
|
|
1892
1892
|
return this._pathLonLat;
|
|
@@ -1932,7 +1932,7 @@ class Polyline {
|
|
|
1932
1932
|
/**
|
|
1933
1933
|
* Sets geodetic coordinates.
|
|
1934
1934
|
* @public
|
|
1935
|
-
* @param {Array.<Array.<number
|
|
1935
|
+
* @param {Array.<Array.<number>>} pathLonLat - Polyline path cartesian coordinates. (exactly 3 entries)
|
|
1936
1936
|
* @param {Boolean} [forceEqual=false] - Makes assigning faster for size equal coordinates array.
|
|
1937
1937
|
*/
|
|
1938
1938
|
setPathLonLat(pathLonLat, forceEqual) {
|
|
@@ -1955,7 +1955,7 @@ class Polyline {
|
|
|
1955
1955
|
/**
|
|
1956
1956
|
* Sets Polyline cartesian coordinates.
|
|
1957
1957
|
* @public
|
|
1958
|
-
* @param {Array.<Array.<number
|
|
1958
|
+
* @param {Array.<Array.<number>>} path3v - Polyline path cartesian coordinates. (exactly 3 entries)
|
|
1959
1959
|
* @param {Boolean} [forceEqual=false] - Makes assigning faster for size equal coordinates array.
|
|
1960
1960
|
*/
|
|
1961
1961
|
setPath3v(path3v, pathColors, forceEqual) {
|