@openglobus/og 0.15.0 → 0.15.2
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/README.md +10 -4
- package/css/og.css +44 -45
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +12 -12
- package/src/og/Clock.js +1 -1
- package/src/og/Events.js +1 -1
- package/src/og/Extent.js +1 -1
- package/src/og/Globe.js +3 -5
- package/src/og/Popup.js +38 -63
- package/src/og/astro/earth.js +2 -2
- package/src/og/astro/rotation.js +2 -2
- package/src/og/bv/Box.js +1 -0
- package/src/og/bv/index.js +1 -1
- package/src/og/camera/Camera.js +4 -4
- package/src/og/camera/PlanetCamera.js +26 -6
- package/src/og/camera/index.js +1 -1
- package/src/og/control/Atmosphere.js +3 -8
- package/src/og/control/CompassButton.js +4 -5
- package/src/og/control/Control.js +25 -15
- package/src/og/control/EarthCoordinates.js +3 -2
- package/src/og/control/EarthNavigation.js +0 -1
- package/src/og/control/GeoImageDragControl.js +2 -2
- package/src/og/control/KeyboardNavigation.js +3 -2
- package/src/og/control/LayerAnimation.js +2 -2
- package/src/og/control/LayerSwitcher.js +5 -4
- package/src/og/control/Lighting.js +106 -35
- package/src/og/control/MouseNavigation.js +4 -4
- package/src/og/control/MouseWheelZoomControl.js +2 -2
- package/src/og/control/RulerSwitcher.js +4 -3
- package/src/og/control/ScaleControl.js +2 -2
- package/src/og/control/ShowFps.js +2 -1
- package/src/og/control/SimpleNavigation.js +2 -1
- package/src/og/control/SimpleSkyBackground.js +2 -2
- package/src/og/control/Sun.js +9 -2
- package/src/og/control/ToggleWireframe.js +2 -1
- package/src/og/control/TouchNavigation.js +4 -3
- package/src/og/control/ZoomControl.js +6 -5
- package/src/og/control/index.js +10 -10
- package/src/og/control/ruler/RulerScene.js +19 -11
- package/src/og/control/selection/Selection.js +1 -1
- package/src/og/control/selection/SelectionScene.js +5 -8
- package/src/og/control/timeline/TimelineControl.js +3 -4
- package/src/og/control/timeline/TimelineModel.js +2 -2
- package/src/og/control/timeline/TimelineView.js +10 -5
- package/src/og/control/visibleExtent/Segment.js +5 -5
- package/src/og/control/visibleExtent/VisibleExtent.js +1 -1
- package/src/og/ellipsoid/Ellipsoid.js +3 -3
- package/src/og/entity/BaseBillboard.js +2 -2
- package/src/og/entity/BillboardHandler.js +10 -2
- package/src/og/entity/Entity.js +10 -51
- package/src/og/entity/EntityCollection.js +3 -20
- package/src/og/entity/GeoObject.js +2 -4
- package/src/og/entity/GeoObjectHandler.js +12 -11
- package/src/og/entity/Geometry.js +2 -2
- package/src/og/entity/GeometryHandler.js +2 -2
- package/src/og/entity/Label.js +2 -2
- package/src/og/entity/LabelHandler.js +7 -5
- package/src/og/entity/Polyline.js +8 -7
- package/src/og/entity/Ray.js +1 -2
- package/src/og/entity/RayHandler.js +4 -0
- package/src/og/entity/Strip.js +8 -5
- package/src/og/entity/index.js +1 -1
- package/src/og/index.core.js +4 -4
- package/src/og/index.js +7 -5
- package/src/og/index.webgl.js +3 -3
- package/src/og/layer/BaseGeoImage.js +2 -2
- package/src/og/layer/GeoImage.js +2 -2
- package/src/og/layer/GeoTexture2d.js +1 -1
- package/src/og/layer/Layer.js +3 -3
- package/src/og/layer/Vector.js +7 -11
- package/src/og/layer/WMS.js +2 -1
- package/src/og/layer/XYZ.js +2 -4
- package/src/og/math/Line3.js +0 -1
- package/src/og/math/Plane.js +0 -1
- package/src/og/math/Ray.js +0 -1
- package/src/og/math/Vec2.js +62 -62
- package/src/og/math/Vec3.js +1 -1
- package/src/og/math/Vec4.js +1 -1
- package/src/og/math/index.js +1 -1
- package/src/og/proj/EPSG3857.js +1 -1
- package/src/og/proj/EPSG4326.js +1 -1
- package/src/og/quadTree/EarthQuadTreeStrategy.js +4 -4
- package/src/og/quadTree/MarsQuadTreeStrategy.js +4 -4
- package/src/og/quadTree/Node.js +1 -1
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +4 -4
- package/src/og/quadTree/index.js +2 -2
- package/src/og/renderer/Renderer.js +196 -77
- package/src/og/renderer/RendererEvents.js +35 -10
- package/src/og/scene/Axes.js +2 -2
- package/src/og/scene/Planet.js +52 -80
- package/src/og/scene/RenderNode.js +2 -13
- package/src/og/scene/SkyBox.js +1 -1
- package/src/og/scene/index.js +2 -2
- package/src/og/segment/Segment.js +5 -5
- package/src/og/segment/SegmentLonLatWgs84.js +2 -3
- package/src/og/shaders/drawnode.js +5 -1
- package/src/og/shaders/geoObject.js +2 -6
- package/src/og/shaders/pickingMask.js +31 -0
- package/src/og/terrain/BilTerrain.js +4 -4
- package/src/og/terrain/GlobusTerrain.js +7 -7
- package/src/og/terrain/MapboxTerrain.js +2 -2
- package/src/og/terrain/index.js +2 -2
- package/src/og/ui/Button.js +5 -4
- package/src/og/ui/Dialog.js +3 -6
- package/src/og/ui/Slider.js +29 -3
- package/src/og/ui/View.js +5 -5
- package/src/og/ui/icons.js +3 -0
- package/src/og/utils/FontAtlas.js +2 -2
- package/src/og/utils/GeoImageCreator.js +0 -1
- package/src/og/utils/NormalMapCreator.js +6 -5
- package/src/og/utils/TerrainWorker.js +1 -1
- package/src/og/utils/VectorTileCreator.js +4 -4
- package/src/og/utils/shared.js +1 -1
- package/src/og/webgl/Framebuffer.js +3 -1
- package/src/og/webgl/Handler.js +77 -62
- package/src/og/webgl/Multisample.js +18 -7
- package/src/og/webgl/Program.js +2 -2
- package/src/og/webgl/index.js +2 -2
- package/types/Popup.d.ts +8 -21
- package/types/camera/PlanetCamera.d.ts +1 -0
- package/types/control/Sun.d.ts +1 -0
- package/types/control/ruler/RulerScene.d.ts +4 -3
- package/types/entity/Entity.d.ts +2 -19
- package/types/entity/EntityCollection.d.ts +0 -7
- package/types/index.d.ts +2 -1
- package/types/math/Vec2.d.ts +95 -95
- package/types/renderer/Renderer.d.ts +28 -16
- package/types/scene/Planet.d.ts +2 -7
- package/types/shaders/pickingMask.d.ts +2 -0
- package/types/ui/Slider.d.ts +3 -0
- package/types/ui/View.d.ts +1 -0
- package/types/ui/icons.d.ts +1 -0
- package/types/webgl/Framebuffer.d.ts +1 -0
- package/types/webgl/Handler.d.ts +3 -2
- package/src/og/entity/ShapeHandler.js +0 -99
- package/src/og/shaders/shape.js +0 -135
- package/src/og/shapes/BaseShape.js +0 -557
- package/src/og/shapes/Icosphere.js +0 -179
- package/src/og/shapes/Sphere.js +0 -100
- package/types/entity/ShapeHandler.d.ts +0 -22
- package/types/shaders/shape.d.ts +0 -4
- package/types/shapes/BaseShape.d.ts +0 -250
- package/types/shapes/Sphere.d.ts +0 -41
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
import { ButtonGroup } from "../../ui/ButtonGroup.js";
|
|
4
|
+
import { ToggleButton } from "../../ui/ToggleButton.js";
|
|
3
5
|
import { View } from '../../ui/View.js';
|
|
4
6
|
import { TimelineModel } from './TimelineModel.js';
|
|
5
7
|
import {
|
|
@@ -11,9 +13,6 @@ import {
|
|
|
11
13
|
getNearestTimeLeft,
|
|
12
14
|
getScale
|
|
13
15
|
} from './timelineUtils.js';
|
|
14
|
-
import { ToggleButton } from "../../ui/ToggleButton.js";
|
|
15
|
-
import { Button } from "../../ui/Button.js";
|
|
16
|
-
import { ButtonGroup } from "../../ui/ButtonGroup.js";
|
|
17
16
|
|
|
18
17
|
const SECONDS_TO_MILLISECONDS = 1000.0;
|
|
19
18
|
const MILLISECONDS_TO_SECONDS = 1.0 / SECONDS_TO_MILLISECONDS;
|
|
@@ -30,7 +29,7 @@ const EVENT_LIST = [
|
|
|
30
29
|
'visibility'
|
|
31
30
|
];
|
|
32
31
|
|
|
33
|
-
const ICON_PLAY_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"
|
|
32
|
+
const ICON_PLAY_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M8 5v14l11-7z" style="fill: black;"/></svg>';
|
|
34
33
|
const ICON_PAUSE_SVG = '<?xml version="1.0" ?><!DOCTYPE svg PUBLIC \'-//W3C//DTD SVG 1.1//EN\' \'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\'><svg enable-background="new 0 0 512 512" height="512px" version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Layer_6"><rect fill="#252525" height="320" width="60" x="153" y="96"/><rect fill="#252525" height="320" width="60" x="299" y="96"/></g></svg>';
|
|
35
34
|
|
|
36
35
|
const SCALE_FILL_COLOR = "rgba(64, 59, 59, 1.0)";
|
|
@@ -179,6 +178,7 @@ class TimelineView extends View {
|
|
|
179
178
|
document.body.addEventListener("mousedown", this._onMouseDown.bind(this));
|
|
180
179
|
document.body.addEventListener("mouseup", this._onMouseUp.bind(this));
|
|
181
180
|
document.body.addEventListener("mousewheel", this._onMouseWheel.bind(this));
|
|
181
|
+
document.body.addEventListener("wheel", this._onMouseWheelFF.bind(this));
|
|
182
182
|
|
|
183
183
|
this._playBtn.appendTo(this.$controls);
|
|
184
184
|
this._pauseBtn.appendTo(this.$controls);
|
|
@@ -268,6 +268,10 @@ class TimelineView extends View {
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
_onMouseWheelFF(e) {
|
|
272
|
+
this._onMouseWheel(e);
|
|
273
|
+
}
|
|
274
|
+
|
|
271
275
|
_zoom(pointerTime, pointerCenterOffsetX, dir) {
|
|
272
276
|
let centerTime = this.model.rangeStartTime + 0.5 * this.model.range;
|
|
273
277
|
|
|
@@ -446,4 +450,5 @@ class TimelineView extends View {
|
|
|
446
450
|
}
|
|
447
451
|
}
|
|
448
452
|
|
|
449
|
-
export { TimelineView }
|
|
453
|
+
export { TimelineView };
|
|
454
|
+
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { EPSG3857 } from "../../proj/EPSG3857.js";
|
|
3
|
+
import { Box } from "../../bv/Box.js";
|
|
4
|
+
import { Sphere } from "../../bv/Sphere.js";
|
|
6
5
|
import { Extent } from "../../Extent.js";
|
|
7
6
|
import { Layer } from "../../layer/Layer.js";
|
|
8
7
|
import { LonLat } from "../../LonLat.js";
|
|
9
8
|
import { Ray } from "../../math/Ray.js";
|
|
10
|
-
import { Sphere } from "../../bv/Sphere.js";
|
|
11
|
-
import { Box } from "../../bv/Box.js";
|
|
12
9
|
import { Vec3 } from "../../math/Vec3.js";
|
|
10
|
+
import * as mercator from "../../mercator.js";
|
|
11
|
+
import { EPSG3857 } from "../../proj/EPSG3857.js";
|
|
12
|
+
import { E, N, NOTRENDERING, OPSIDE, S, W } from "../../quadTree/quadTree.js";
|
|
13
13
|
import * as segmentHelper from "../../segment/segmentHelper.js";
|
|
14
14
|
import { getMatrixSubArray } from "../../utils/shared.js";
|
|
15
15
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { Slice } from "../../segment/Slice.js";
|
|
3
4
|
import { Control } from "../Control.js";
|
|
4
5
|
import * as shaders from "./drawnode.js";
|
|
5
|
-
import { Slice } from "../../segment/Slice.js";
|
|
6
6
|
|
|
7
7
|
function rewriteSlice() {
|
|
8
8
|
Slice.prototype.init = function (segment) {
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Vec3 } from "../math/Vec3.js";
|
|
8
7
|
import { LonLat } from "../LonLat.js";
|
|
9
|
-
import { EPS1, EPS12, EPS15, RADIANS
|
|
8
|
+
import { DEGREES, EPS1, EPS12, EPS15, RADIANS } from "../math.js";
|
|
9
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Class represents a plant ellipsoid.
|
|
@@ -621,4 +621,4 @@ class Ellipsoid {
|
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
|
|
624
|
-
export { Ellipsoid };
|
|
624
|
+
export { Ellipsoid };
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as utils from "../utils/shared.js";
|
|
8
7
|
import { Vec3 } from "../math/Vec3.js";
|
|
8
|
+
import * as utils from "../utils/shared.js";
|
|
9
9
|
import { LOCK_FREE, LOCK_UPDATE } from "./LabelWorker.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -376,4 +376,4 @@ class BaseBillboard {
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
export { BaseBillboard };
|
|
379
|
+
export { BaseBillboard };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as shaders from "../shaders/billboard.js";
|
|
8
8
|
import { concatTypedArrays, spliceTypedArray } from "../utils/shared.js";
|
|
9
|
-
import {
|
|
9
|
+
import { LOCK_FREE } from "./LabelWorker.js";
|
|
10
10
|
|
|
11
11
|
const PICKINGCOLOR_BUFFER = 0;
|
|
12
12
|
const POSITION_BUFFER = 1;
|
|
@@ -348,6 +348,8 @@ class BillboardHandler {
|
|
|
348
348
|
|
|
349
349
|
var gl = h.gl,
|
|
350
350
|
ec = this._entityCollection;
|
|
351
|
+
|
|
352
|
+
gl.disable(gl.CULL_FACE);
|
|
351
353
|
|
|
352
354
|
gl.uniform1f(shu.depthOffset, ec.polygonOffsetUnits + window.BILLBOARD_DEPTH_OFFSET);
|
|
353
355
|
|
|
@@ -392,6 +394,8 @@ class BillboardHandler {
|
|
|
392
394
|
gl.vertexAttribPointer(sha.a_rotation, this._rotationBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
393
395
|
|
|
394
396
|
gl.drawArrays(gl.TRIANGLES, 0, this._vertexBuffer.numItems);
|
|
397
|
+
|
|
398
|
+
gl.enable(gl.CULL_FACE);
|
|
395
399
|
}
|
|
396
400
|
|
|
397
401
|
_pickingPASS() {
|
|
@@ -405,6 +409,8 @@ class BillboardHandler {
|
|
|
405
409
|
var gl = h.gl,
|
|
406
410
|
ec = this._entityCollection;
|
|
407
411
|
|
|
412
|
+
gl.disable(gl.CULL_FACE);
|
|
413
|
+
|
|
408
414
|
gl.uniform1f(shu.depthOffset, ec.polygonOffsetUnits + window.BILLBOARD_DEPTH_OFFSET);
|
|
409
415
|
|
|
410
416
|
gl.uniformMatrix4fv(shu.viewMatrix, false, r.activeCamera._viewMatrix._m);
|
|
@@ -442,6 +448,8 @@ class BillboardHandler {
|
|
|
442
448
|
gl.vertexAttribPointer(sha.a_rotation, this._rotationBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
443
449
|
|
|
444
450
|
gl.drawArrays(gl.TRIANGLES, 0, this._vertexBuffer.numItems);
|
|
451
|
+
|
|
452
|
+
gl.enable(gl.CULL_FACE);
|
|
445
453
|
}
|
|
446
454
|
|
|
447
455
|
draw() {
|
|
@@ -876,4 +884,4 @@ class BillboardHandler {
|
|
|
876
884
|
}
|
|
877
885
|
}
|
|
878
886
|
|
|
879
|
-
export { BillboardHandler };
|
|
887
|
+
export { BillboardHandler };
|
package/src/og/entity/Entity.js
CHANGED
|
@@ -4,20 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
+
import { Extent } from "../Extent.js";
|
|
8
|
+
import { LonLat } from "../LonLat.js";
|
|
9
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
7
10
|
import * as mercator from "../mercator.js";
|
|
8
11
|
import * as utils from "../utils/shared.js";
|
|
9
12
|
import { Billboard } from "./Billboard.js";
|
|
10
|
-
import { Strip } from "./Strip.js";
|
|
11
|
-
import { Extent } from "../Extent.js";
|
|
12
13
|
import { Geometry } from "./Geometry.js";
|
|
14
|
+
import { GeoObject } from "./GeoObject.js";
|
|
13
15
|
import { Label } from "./Label.js";
|
|
14
|
-
import {
|
|
16
|
+
import { PointCloud } from "./PointCloud.js";
|
|
15
17
|
import { Polyline } from "./Polyline.js";
|
|
16
18
|
import { Ray } from "./Ray.js";
|
|
17
|
-
import {
|
|
18
|
-
import { Sphere } from "../shapes/Sphere.js";
|
|
19
|
-
import { Vec3 } from "../math/Vec3.js";
|
|
20
|
-
import { GeoObject } from "./GeoObject.js";
|
|
19
|
+
import { Strip } from "./Strip.js";
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Entity instances aggregate multiple forms of visualization into a single high-level object.
|
|
@@ -26,14 +25,12 @@ import { GeoObject } from "./GeoObject.js";
|
|
|
26
25
|
* @class
|
|
27
26
|
* @param {Object} [options] - Entity options:
|
|
28
27
|
* @param {string} [options.name] - A human readable name to display to users. It does not have to be unique.
|
|
29
|
-
* @param {Vec3|Array.<number>} [options.cartesian] - Spatial entities like billboard, label
|
|
30
|
-
* @param {LonLat} [options.lonlat] - Geodetic coordiantes for an entities like billboard, label
|
|
28
|
+
* @param {Vec3|Array.<number>} [options.cartesian] - Spatial entities like billboard, label etc. cartesian position.
|
|
29
|
+
* @param {LonLat} [options.lonlat] - Geodetic coordiantes for an entities like billboard, label etc.
|
|
31
30
|
* @param {boolean} [options.aground] - True for entities that have to be placed on the relief.
|
|
32
31
|
* @param {boolean} [options.visibility] - Entity visibility.
|
|
33
32
|
* @param {*} [options.billboard] - Billboard options(see {@link og.Billboard}).
|
|
34
33
|
* @param {*} [options.label] - Label options(see {@link og.Label}).
|
|
35
|
-
* @param {*} [options.sphere] - Sphere options(see {@link og.shape.Sphere}).
|
|
36
|
-
* @param {*} [options.box] - Sphere options(see {@link og.shape.Box}).
|
|
37
34
|
* @param {*} [options.polyline] - Polyline options(see {@link og.Polyline}).
|
|
38
35
|
* @param {*} [options.ray] - Ray options(see {@link og.Ray}).
|
|
39
36
|
* @param {*} [options.pointCloud] - Point cloud options(see {@link og.PointCloud}).
|
|
@@ -154,8 +151,6 @@ class Entity {
|
|
|
154
151
|
this._featureConstructorArray = {
|
|
155
152
|
billboard: [Billboard, this.setBillboard],
|
|
156
153
|
label: [Label, this.setLabel],
|
|
157
|
-
sphere: [Sphere, this.setShape],
|
|
158
|
-
// box: [Box, this.setShape],
|
|
159
154
|
polyline: [Polyline, this.setPolyline],
|
|
160
155
|
pointCloud: [PointCloud, this.setPointCloud],
|
|
161
156
|
geometry: [Geometry, this.setGeometry],
|
|
@@ -178,13 +173,6 @@ class Entity {
|
|
|
178
173
|
*/
|
|
179
174
|
this.label = this._createOptionFeature("label", options.label);
|
|
180
175
|
|
|
181
|
-
/**
|
|
182
|
-
* Shape entity.
|
|
183
|
-
* @public
|
|
184
|
-
* @type {shape.BaseShape}
|
|
185
|
-
*/
|
|
186
|
-
this.shape = this._createOptionFeature("sphere", options.sphere || options.box);
|
|
187
|
-
|
|
188
176
|
/**
|
|
189
177
|
* Polyline entity.
|
|
190
178
|
* @public
|
|
@@ -293,9 +281,6 @@ class Entity {
|
|
|
293
281
|
// labels
|
|
294
282
|
this.label && this.label.setVisibility(visibility);
|
|
295
283
|
|
|
296
|
-
// shape
|
|
297
|
-
this.shape && this.shape.setVisibility(visibility);
|
|
298
|
-
|
|
299
284
|
// polyline
|
|
300
285
|
this.polyline && this.polyline.setVisibility(visibility);
|
|
301
286
|
|
|
@@ -351,9 +336,6 @@ class Entity {
|
|
|
351
336
|
// labels
|
|
352
337
|
this.label && this.label.setPosition3v(p);
|
|
353
338
|
|
|
354
|
-
// shape
|
|
355
|
-
this.shape && this.shape.setPosition3v(p);
|
|
356
|
-
|
|
357
339
|
for (let i = 0; i < this.childrenNodes.length; i++) {
|
|
358
340
|
this.childrenNodes[i].setCartesian(x, y, z);
|
|
359
341
|
}
|
|
@@ -395,9 +377,6 @@ class Entity {
|
|
|
395
377
|
// labels
|
|
396
378
|
this.label && this.label.setPosition3v(p);
|
|
397
379
|
|
|
398
|
-
// shape
|
|
399
|
-
this.shape && this.shape.setPosition3v(p);
|
|
400
|
-
|
|
401
380
|
for (let i = 0; i < this.childrenNodes.length; i++) {
|
|
402
381
|
this.childrenNodes[i].setCartesian(p.x, p.y, p.z);
|
|
403
382
|
}
|
|
@@ -556,24 +535,6 @@ class Entity {
|
|
|
556
535
|
return ray;
|
|
557
536
|
}
|
|
558
537
|
|
|
559
|
-
/**
|
|
560
|
-
* Sets entity shape.
|
|
561
|
-
* @public
|
|
562
|
-
* @param {BaseShape} shape - Shape object.
|
|
563
|
-
* @returns {Polyline} -
|
|
564
|
-
*/
|
|
565
|
-
setShape(shape) {
|
|
566
|
-
if (this.shape) {
|
|
567
|
-
this.shape.remove();
|
|
568
|
-
}
|
|
569
|
-
this.shape = shape;
|
|
570
|
-
this.shape._entity = this;
|
|
571
|
-
this.shape.setPosition3v(this._cartesian);
|
|
572
|
-
this.shape.setVisibility(this._visibility);
|
|
573
|
-
this._entityCollection && this._entityCollection._shapeHandler.add(shape);
|
|
574
|
-
return shape;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
538
|
/**
|
|
578
539
|
* Sets entity polyline.
|
|
579
540
|
* @public
|
|
@@ -699,9 +660,6 @@ class Entity {
|
|
|
699
660
|
// label
|
|
700
661
|
this.label && this.label.setPickingColor3v(c);
|
|
701
662
|
|
|
702
|
-
// shape
|
|
703
|
-
this.shape && this.shape.setPickingColor3v(c);
|
|
704
|
-
|
|
705
663
|
// polyline
|
|
706
664
|
this.polyline && this.polyline.setPickingColor3v(c);
|
|
707
665
|
|
|
@@ -711,8 +669,9 @@ class Entity {
|
|
|
711
669
|
// strip
|
|
712
670
|
this.strip && this.strip.setPickingColor3v(c);
|
|
713
671
|
|
|
714
|
-
//
|
|
672
|
+
// geoObject
|
|
715
673
|
this.geoObject && this.geoObject.setPickingColor3v(c);
|
|
674
|
+
|
|
716
675
|
for (let i = 0; i < this.childrenNodes.length; i++) {
|
|
717
676
|
this.childrenNodes[i].setPickingColor();
|
|
718
677
|
}
|
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
+
import { Events } from "../Events.js";
|
|
7
8
|
import * as math from "../math.js";
|
|
8
9
|
import { BillboardHandler } from "./BillboardHandler.js";
|
|
9
|
-
import {
|
|
10
|
+
import { GeoObjectHandler } from "./GeoObjectHandler.js";
|
|
10
11
|
import { LabelHandler } from "./LabelHandler.js";
|
|
12
|
+
import { PointCloudHandler } from "./PointCloudHandler.js";
|
|
11
13
|
import { PolylineHandler } from "./PolylineHandler.js";
|
|
12
14
|
import { RayHandler } from "./RayHandler.js";
|
|
13
|
-
import { PointCloudHandler } from "./PointCloudHandler.js";
|
|
14
15
|
import { StripHandler } from "./StripHandler.js";
|
|
15
|
-
import { ShapeHandler } from "./ShapeHandler.js";
|
|
16
|
-
import { GeoObjectHandler } from "./GeoObjectHandler.js";
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* An observable collection of og.Entity instances where each entity has a unique id.
|
|
@@ -117,13 +116,6 @@ class EntityCollection {
|
|
|
117
116
|
*/
|
|
118
117
|
this.labelHandler = new LabelHandler(this, options.labelMaxLetters);
|
|
119
118
|
|
|
120
|
-
/**
|
|
121
|
-
* Shape handler
|
|
122
|
-
* @public
|
|
123
|
-
* @type {ShapeHandler}
|
|
124
|
-
*/
|
|
125
|
-
this.shapeHandler = new ShapeHandler(this);
|
|
126
|
-
|
|
127
119
|
/**
|
|
128
120
|
* Polyline handler
|
|
129
121
|
* @public
|
|
@@ -264,7 +256,6 @@ class EntityCollection {
|
|
|
264
256
|
this.labelHandler.pickingEnabled = enable;
|
|
265
257
|
this.polylineHandler.pickingEnabled = enable;
|
|
266
258
|
this.rayHandler.pickingEnabled = enable;
|
|
267
|
-
this.shapeHandler.pickingEnabled = enable;
|
|
268
259
|
this.pointCloudHandler.pickingEnabled = enable;
|
|
269
260
|
this.stripHandler.pickingEnabled = enable;
|
|
270
261
|
this.geoObjectHandler.pickingEnabled = enable;
|
|
@@ -299,9 +290,6 @@ class EntityCollection {
|
|
|
299
290
|
// label
|
|
300
291
|
entity.label && this.labelHandler.add(entity.label);
|
|
301
292
|
|
|
302
|
-
// shape
|
|
303
|
-
entity.shape && this.shapeHandler.add(entity.shape);
|
|
304
|
-
|
|
305
293
|
// polyline
|
|
306
294
|
entity.polyline && this.polylineHandler.add(entity.polyline);
|
|
307
295
|
|
|
@@ -387,9 +375,6 @@ class EntityCollection {
|
|
|
387
375
|
// label
|
|
388
376
|
entity.label && this.labelHandler.remove(entity.label);
|
|
389
377
|
|
|
390
|
-
// shape
|
|
391
|
-
entity.shape && this.shapeHandler.remove(entity.shape);
|
|
392
|
-
|
|
393
378
|
// polyline
|
|
394
379
|
entity.polyline && this.polylineHandler.remove(entity.polyline);
|
|
395
380
|
|
|
@@ -506,7 +491,6 @@ class EntityCollection {
|
|
|
506
491
|
this.labelHandler.setRenderer(renderNode.renderer);
|
|
507
492
|
this.rayHandler.setRenderer(renderNode.renderer);
|
|
508
493
|
this.geoObjectHandler.setRenderNode(renderNode);
|
|
509
|
-
this.shapeHandler.setRenderNode(renderNode);
|
|
510
494
|
this.polylineHandler.setRenderNode(renderNode);
|
|
511
495
|
this.pointCloudHandler.setRenderNode(renderNode);
|
|
512
496
|
this.stripHandler.setRenderNode(renderNode);
|
|
@@ -610,7 +594,6 @@ class EntityCollection {
|
|
|
610
594
|
// code to the clearEntity function.
|
|
611
595
|
this.billboardHandler.clear();
|
|
612
596
|
this.labelHandler.clear();
|
|
613
|
-
this.shapeHandler.clear();
|
|
614
597
|
this.polylineHandler.clear();
|
|
615
598
|
this.rayHandler.clear();
|
|
616
599
|
this.pointCloudHandler.clear();
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module og/
|
|
2
|
+
* @module og/entity/GeoObject
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
7
|
import { Quat, Vec3 } from "../math/index.js";
|
|
8
|
-
import { MAX32, RADIANS, lerp } from "../math.js";
|
|
9
|
-
import { LonLat } from "../LonLat.js";
|
|
10
|
-
import * as utils from "../utils/shared.js";
|
|
11
8
|
import { Planet } from "../scene/Planet.js";
|
|
9
|
+
import * as utils from "../utils/shared.js";
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* @class
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @module og/entity/
|
|
4
|
+
* @module og/entity/GeoObjectHandler
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
import * as shaders from "../shaders/geoObject.js";
|
|
7
8
|
import { concatArrays, loadImage, makeArrayTyped, spliceArray } from "../utils/shared.js";
|
|
8
9
|
|
|
@@ -257,7 +258,7 @@ class InstanceData {
|
|
|
257
258
|
createIndicesBuffer() {
|
|
258
259
|
const h = this._geoObjectHandler._planet.renderer.handler;
|
|
259
260
|
h.gl.deleteBuffer(this._indicesBuffer);
|
|
260
|
-
this._indicesArr = makeArrayTyped(this._indicesArr,
|
|
261
|
+
this._indicesArr = makeArrayTyped(this._indicesArr, Uint32Array);
|
|
261
262
|
this._indicesBuffer = h.createElementArrayBuffer(this._indicesArr, 1, this._indicesArr.length);
|
|
262
263
|
}
|
|
263
264
|
|
|
@@ -424,7 +425,6 @@ class GeoObjectHandler {
|
|
|
424
425
|
//
|
|
425
426
|
// Could be in VAO
|
|
426
427
|
//
|
|
427
|
-
gl.enable(gl.CULL_FACE);
|
|
428
428
|
gl.uniform3fv(u.uScaleByDistance, ec.scaleByDistance);
|
|
429
429
|
|
|
430
430
|
gl.uniform3fv(u.eyePositionHigh, r.activeCamera.eyeHigh);
|
|
@@ -482,11 +482,9 @@ class GeoObjectHandler {
|
|
|
482
482
|
gl.bindBuffer(gl.ARRAY_BUFFER, tagData._texCoordBuffer);
|
|
483
483
|
gl.vertexAttribPointer(a.aTexCoord, tagData._texCoordBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
484
484
|
|
|
485
|
-
|
|
486
485
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, tagData._indicesBuffer);
|
|
487
|
-
p.drawElementsInstanced(gl.TRIANGLES, tagData._indicesBuffer.numItems, gl.
|
|
486
|
+
p.drawElementsInstanced(gl.TRIANGLES, tagData._indicesBuffer.numItems, gl.UNSIGNED_INT, 0, tagData.numInstances);
|
|
488
487
|
}
|
|
489
|
-
gl.disable(gl.CULL_FACE);
|
|
490
488
|
}
|
|
491
489
|
|
|
492
490
|
drawPicking() {
|
|
@@ -496,12 +494,16 @@ class GeoObjectHandler {
|
|
|
496
494
|
}
|
|
497
495
|
|
|
498
496
|
_pickingPASS() {
|
|
499
|
-
let r = this._planet.renderer,
|
|
500
|
-
|
|
497
|
+
let r = this._planet.renderer,
|
|
498
|
+
sh = r.handler.programs.geo_object_picking,
|
|
499
|
+
p = sh._program,
|
|
500
|
+
u = p.uniforms,
|
|
501
|
+
a = p.attributes,
|
|
502
|
+
gl = r.handler.gl,
|
|
503
|
+
ec = this._entityCollection;
|
|
501
504
|
|
|
502
505
|
sh.activate();
|
|
503
506
|
|
|
504
|
-
gl.enable(gl.CULL_FACE);
|
|
505
507
|
gl.uniform3fv(u.uScaleByDistance, ec.scaleByDistance);
|
|
506
508
|
|
|
507
509
|
gl.uniform1f(u.pickingScale, ec.pickingScale);
|
|
@@ -546,9 +548,8 @@ class GeoObjectHandler {
|
|
|
546
548
|
gl.vertexAttribPointer(a.aVertexPosition, tagData._vertexBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
547
549
|
|
|
548
550
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, tagData._indicesBuffer);
|
|
549
|
-
p.drawElementsInstanced(gl.TRIANGLES, tagData._indicesBuffer.numItems, gl.
|
|
551
|
+
p.drawElementsInstanced(gl.TRIANGLES, tagData._indicesBuffer.numItems, gl.UNSIGNED_INT, 0, tagData.numInstances);
|
|
550
552
|
}
|
|
551
|
-
gl.disable(gl.CULL_FACE);
|
|
552
553
|
}
|
|
553
554
|
|
|
554
555
|
async _loadDataTagTexture(tagData) {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as utils from "../utils/shared.js";
|
|
8
7
|
import { Extent } from "../Extent.js";
|
|
9
|
-
import { Vec4 } from "../math/Vec4.js";
|
|
10
8
|
import { LonLat } from "../LonLat.js";
|
|
9
|
+
import { Vec4 } from "../math/Vec4.js";
|
|
10
|
+
import * as utils from "../utils/shared.js";
|
|
11
11
|
|
|
12
12
|
const GeometryType = {
|
|
13
13
|
POINT: 1,
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
+
import { doubleToTwoFloatsV2 } from "../math/coder.js";
|
|
8
|
+
import { Vec2 } from "../math/Vec2.js";
|
|
7
9
|
import * as mercator from "../mercator.js";
|
|
8
10
|
import * as quadTree from "../quadTree/quadTree.js";
|
|
9
11
|
import { earcut, flatten } from "../utils/earcut.js";
|
|
10
12
|
import { GeometryType } from "./Geometry.js";
|
|
11
|
-
import { Vec2 } from "../math/Vec2.js";
|
|
12
|
-
import { doubleToTwoFloatsV2 } from "../math/coder.js";
|
|
13
13
|
|
|
14
14
|
const POLYVERTICES_BUFFER = 0;
|
|
15
15
|
const POLYINDEXES_BUFFER = 1;
|
package/src/og/entity/Label.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
+
import { Vec4 } from "../math/Vec4.js";
|
|
7
8
|
import * as utils from "../utils/shared.js";
|
|
8
9
|
import { BaseBillboard } from "./BaseBillboard.js";
|
|
9
|
-
import { Vec4 } from "../math/Vec4.js";
|
|
10
10
|
import { LOCK_FREE, LOCK_UPDATE } from "./LabelWorker.js";
|
|
11
11
|
|
|
12
12
|
const ALIGN = {
|
|
@@ -346,4 +346,4 @@ class Label extends BaseBillboard {
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
export { Label, ALIGN };
|
|
349
|
+
export { Label, ALIGN };
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
7
|
import * as shaders from "../shaders/label.js";
|
|
8
|
-
import { ALIGN } from "./Label.js";
|
|
9
|
-
import { BillboardHandler } from "./BillboardHandler.js";
|
|
10
8
|
import { concatTypedArrays, spliceTypedArray } from "../utils/shared.js";
|
|
9
|
+
import { BillboardHandler } from "./BillboardHandler.js";
|
|
10
|
+
import { ALIGN } from "./Label.js";
|
|
11
11
|
import { LOCK_FREE } from "./LabelWorker.js";
|
|
12
12
|
|
|
13
13
|
const PICKINGCOLOR_BUFFER = 0;
|
|
@@ -205,7 +205,6 @@ class LabelHandler extends BillboardHandler {
|
|
|
205
205
|
ec = this._entityCollection;
|
|
206
206
|
|
|
207
207
|
gl.disable(gl.CULL_FACE);
|
|
208
|
-
//gl.disable(gl.DEPTH_TEST);
|
|
209
208
|
|
|
210
209
|
gl.uniform1iv(shu.fontTextureArr, r.fontAtlas.samplerArr);
|
|
211
210
|
gl.uniform4fv(shu.sdfParamsArr, r.fontAtlas.sdfParamsArr);
|
|
@@ -287,6 +286,8 @@ class LabelHandler extends BillboardHandler {
|
|
|
287
286
|
|
|
288
287
|
var rn = ec.renderNode;
|
|
289
288
|
|
|
289
|
+
gl.disable(gl.CULL_FACE);
|
|
290
|
+
|
|
290
291
|
gl.uniformMatrix4fv(shu.viewMatrix, false, r.activeCamera._viewMatrix._m);
|
|
291
292
|
gl.uniformMatrix4fv(shu.projectionMatrix, false, r.activeCamera.getProjectionMatrix());
|
|
292
293
|
gl.uniform3fv(shu.eyePositionHigh, r.activeCamera.eyeHigh);
|
|
@@ -325,8 +326,9 @@ class LabelHandler extends BillboardHandler {
|
|
|
325
326
|
|
|
326
327
|
gl.uniform1f(shu.depthOffset, ec.polygonOffsetUnits + window.LABEL_DEPTH_OFFSET);
|
|
327
328
|
|
|
328
|
-
|
|
329
329
|
gl.drawArrays(gl.TRIANGLES, 0, this._vertexBuffer.numItems);
|
|
330
|
+
|
|
331
|
+
gl.enable(gl.CULL_FACE);
|
|
330
332
|
}
|
|
331
333
|
|
|
332
334
|
_removeBillboard(label) {
|
|
@@ -894,4 +896,4 @@ class LabelHandler extends BillboardHandler {
|
|
|
894
896
|
}
|
|
895
897
|
}
|
|
896
898
|
|
|
897
|
-
export { LabelHandler };
|
|
899
|
+
export { LabelHandler };
|
|
@@ -4,16 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
makeArrayTyped,
|
|
9
|
-
makeArray,
|
|
10
|
-
htmlColorToFloat32Array,
|
|
11
|
-
htmlColorToRgba,
|
|
12
|
-
cloneArray
|
|
13
|
-
} from "../utils/shared.js";
|
|
14
7
|
import { Extent } from "../Extent.js";
|
|
15
8
|
import { LonLat } from "../LonLat.js";
|
|
16
9
|
import { Vec3 } from "../math/Vec3.js";
|
|
10
|
+
import {
|
|
11
|
+
cloneArray, htmlColorToFloat32Array,
|
|
12
|
+
htmlColorToRgba, makeArray, makeArrayTyped
|
|
13
|
+
} from "../utils/shared.js";
|
|
17
14
|
|
|
18
15
|
window.POLYLINE_DEPTH_OFFSET = 0.0;
|
|
19
16
|
|
|
@@ -2035,6 +2032,8 @@ class Polyline {
|
|
|
2035
2032
|
|
|
2036
2033
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer);
|
|
2037
2034
|
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
2035
|
+
|
|
2036
|
+
gl.enable(gl.CULL_FACE);
|
|
2038
2037
|
}
|
|
2039
2038
|
}
|
|
2040
2039
|
|
|
@@ -2091,6 +2090,8 @@ class Polyline {
|
|
|
2091
2090
|
|
|
2092
2091
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexesBuffer);
|
|
2093
2092
|
gl.drawElements(gl.TRIANGLE_STRIP, this._indexesBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
2093
|
+
|
|
2094
|
+
gl.enable(gl.CULL_FACE);
|
|
2094
2095
|
}
|
|
2095
2096
|
}
|
|
2096
2097
|
|
package/src/og/entity/Ray.js
CHANGED
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as utils from "../utils/shared.js";
|
|
8
7
|
import { Vec3 } from "../math/Vec3.js";
|
|
8
|
+
import * as utils from "../utils/shared.js";
|
|
9
9
|
import { Entity } from "./Entity.js";
|
|
10
|
-
import { doubleToTwoFloats2 } from "../math/coder.js";
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Ray class.
|
|
@@ -365,6 +365,8 @@ class RayHandler {
|
|
|
365
365
|
|
|
366
366
|
//gl.polygonOffset(ec.polygonOffsetFactor, ec.polygonOffsetUnits);
|
|
367
367
|
|
|
368
|
+
gl.disable(gl.CULL_FACE);
|
|
369
|
+
|
|
368
370
|
gl.uniform1f(shu.uOpacity, ec._fadingOpacity);
|
|
369
371
|
|
|
370
372
|
gl.uniformMatrix4fv(shu.viewMatrix, false, r.activeCamera.getViewMatrix());
|
|
@@ -432,6 +434,8 @@ class RayHandler {
|
|
|
432
434
|
gl.vertexAttribPointer(sha.a_vertices, this._vertexBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
433
435
|
|
|
434
436
|
gl.drawArrays(gl.TRIANGLES, 0, this._vertexBuffer.numItems);
|
|
437
|
+
|
|
438
|
+
gl.enable(gl.CULL_FACE);
|
|
435
439
|
}
|
|
436
440
|
|
|
437
441
|
_pickingPASS() {
|