@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "[OpenGlobus](https://www.openglobus.org/) is a javascript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers and 3d objects. It uses the WebGL technology, open source and completely free.",
|
|
5
5
|
"directories": {
|
|
6
6
|
"example": "./sandbox"
|
|
@@ -46,23 +46,23 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/preset-env": "^7.20.2",
|
|
48
48
|
"@rollup/plugin-json": "^6.0.0",
|
|
49
|
-
"@rollup/plugin-terser": "^0.
|
|
50
|
-
"@types/jest": "^29.
|
|
51
|
-
"eslint": "^8.
|
|
52
|
-
"jaguarjs-jsdoc": "^1.0
|
|
53
|
-
"jest": "^29.
|
|
49
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
50
|
+
"@types/jest": "^29.4.0",
|
|
51
|
+
"eslint": "^8.35.0",
|
|
52
|
+
"jaguarjs-jsdoc": "^1.1.0",
|
|
53
|
+
"jest": "^29.5.0",
|
|
54
54
|
"jest-canvas-mock": "^2.4.0",
|
|
55
|
-
"jest-environment-jsdom": "^29.
|
|
55
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
56
56
|
"jest-webgl-canvas-mock": "^0.2.3",
|
|
57
57
|
"jsdoc": "^4.0.2",
|
|
58
|
-
"lint-staged": "^13.1.
|
|
59
|
-
"local-web-server": "^5.
|
|
58
|
+
"lint-staged": "^13.1.2",
|
|
59
|
+
"local-web-server": "^5.3.0",
|
|
60
60
|
"postcss": "^8.4.21",
|
|
61
|
-
"prettier": "^2.8.
|
|
62
|
-
"rollup": "^3.
|
|
61
|
+
"prettier": "^2.8.4",
|
|
62
|
+
"rollup": "^3.18.0",
|
|
63
63
|
"rollup-plugin-postcss": "^4.0.2",
|
|
64
64
|
"taffydb": "^2.7.3",
|
|
65
|
-
"typescript": "^4.9.
|
|
65
|
+
"typescript": "^4.9.5"
|
|
66
66
|
},
|
|
67
67
|
"lint-staged": {
|
|
68
68
|
"*.{js,ts}": [
|
package/src/og/Clock.js
CHANGED
package/src/og/Events.js
CHANGED
package/src/og/Extent.js
CHANGED
package/src/og/Globe.js
CHANGED
|
@@ -8,18 +8,16 @@ import { CompassButton } from "./control/CompassButton.js";
|
|
|
8
8
|
import { EarthCoordinates } from "./control/EarthCoordinates.js";
|
|
9
9
|
import { EarthNavigation } from "./control/EarthNavigation.js";
|
|
10
10
|
import { MouseNavigation } from "./control/MouseNavigation.js";
|
|
11
|
-
import { KeyboardNavigation } from "./control/KeyboardNavigation.js";
|
|
12
11
|
import { ScaleControl } from "./control/ScaleControl.js";
|
|
13
12
|
import { Sun } from "./control/Sun.js";
|
|
14
13
|
import { TouchNavigation } from "./control/TouchNavigation.js";
|
|
15
14
|
import { ZoomControl } from "./control/ZoomControl.js";
|
|
15
|
+
import { Vec3 } from "./math/Vec3.js";
|
|
16
16
|
import { Renderer } from "./renderer/Renderer.js";
|
|
17
17
|
import { Planet } from "./scene/Planet.js";
|
|
18
18
|
import { EmptyTerrain } from "./terrain/EmptyTerrain.js";
|
|
19
|
-
import { isEmpty } from "./utils/shared.js";
|
|
19
|
+
import { createColorRGB, isEmpty } from "./utils/shared.js";
|
|
20
20
|
import { Handler } from "./webgl/Handler.js";
|
|
21
|
-
import { createColorRGB } from "./utils/shared.js";
|
|
22
|
-
import { Vec3 } from "./math/Vec3.js";
|
|
23
21
|
|
|
24
22
|
/** @const {string} */
|
|
25
23
|
const CANVAS_ID_PREFIX = "globus_viewport_";
|
|
@@ -142,7 +140,7 @@ class Globe {
|
|
|
142
140
|
if (options.attributionContainer) {
|
|
143
141
|
options.attributionContainer.appendChild(this.div.attributions);
|
|
144
142
|
} else {
|
|
145
|
-
this.div.attributions.classList.add("
|
|
143
|
+
this.div.attributions.classList.add("og-attribution");
|
|
146
144
|
this.div.appendChild(this.div.attributions);
|
|
147
145
|
}
|
|
148
146
|
|
package/src/og/Popup.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Events } from "./Events.js";
|
|
4
3
|
import { Vec3 } from "./math/Vec3.js";
|
|
5
|
-
import {
|
|
4
|
+
import { createLonLat, stringTemplate } from "./utils/shared.js";
|
|
5
|
+
import { View } from './ui/View.js';
|
|
6
|
+
import { CLOSE_ICON } from './ui/icons.js';
|
|
6
7
|
|
|
7
8
|
const TEMPLATE = `<div class="og-popup {className}">
|
|
8
9
|
<div class="og-popup-content-wrapper">
|
|
@@ -12,33 +13,27 @@ const TEMPLATE = `<div class="og-popup {className}">
|
|
|
12
13
|
<div class="og-popup-tip"></div>
|
|
13
14
|
</div>
|
|
14
15
|
<div class="og-popup-toolbar">
|
|
15
|
-
<div class="og-popup-btn og-popup-close"
|
|
16
|
-
</div>
|
|
17
|
-
<div class="og-popup-title">
|
|
16
|
+
<div class="og-popup-btn og-popup-close">${CLOSE_ICON}</div>
|
|
18
17
|
</div>
|
|
18
|
+
<div class="og-popup-title">{title}</div>
|
|
19
19
|
</div>`;
|
|
20
20
|
|
|
21
|
-
class Popup {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this._template = getHTML(TEMPLATE, { className: options.className });
|
|
32
|
-
|
|
33
|
-
this.el = null;
|
|
34
|
-
|
|
35
|
-
this._title = options.title || "";
|
|
36
|
-
|
|
37
|
-
this._content = options.content || null;
|
|
21
|
+
class Popup extends View {
|
|
22
|
+
constructor(options = {}) {
|
|
23
|
+
super({
|
|
24
|
+
template: stringTemplate(TEMPLATE, {
|
|
25
|
+
title: options.title || ""
|
|
26
|
+
}),
|
|
27
|
+
eventList: ["open", "close"],
|
|
28
|
+
classList: options.className ? [options.className] : [],
|
|
29
|
+
...options
|
|
30
|
+
});
|
|
38
31
|
|
|
39
|
-
this.
|
|
32
|
+
this._content = options.content || "";
|
|
40
33
|
|
|
41
|
-
this
|
|
34
|
+
this.$content = null;
|
|
35
|
+
this.$tip = null;
|
|
36
|
+
this.$title = null;
|
|
42
37
|
|
|
43
38
|
this._planet = options.planet;
|
|
44
39
|
|
|
@@ -53,21 +48,6 @@ class Popup {
|
|
|
53
48
|
this.render();
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
static get _staticCounter() {
|
|
57
|
-
if (!this.__counter__ && this.__counter__ !== 0) {
|
|
58
|
-
this.__counter__ = 0;
|
|
59
|
-
}
|
|
60
|
-
return this.__counter__;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
static set _staticCounter(n) {
|
|
64
|
-
this.__counter__ = n;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
_renderTemplate() {
|
|
68
|
-
return parseHTML(this._template)[0];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
51
|
_updatePosition() {
|
|
72
52
|
this.setCartesian3v(this._cartPos);
|
|
73
53
|
}
|
|
@@ -76,11 +56,7 @@ class Popup {
|
|
|
76
56
|
if (this._planet) {
|
|
77
57
|
let r = this._planet.renderer.handler.pixelRatio;
|
|
78
58
|
this.el.style.transform =
|
|
79
|
-
|
|
80
|
-
(p.x / r - this.clientWidth * 0.5) +
|
|
81
|
-
"px, " +
|
|
82
|
-
(p.y / r - this._planet.renderer.handler.canvas.clientHeight - this._tipEl.clientHeight) +
|
|
83
|
-
"px)";
|
|
59
|
+
`translate(${p.x / r - this.clientWidth * 0.5}px, ${p.y / r - this._planet.renderer.handler.canvas.clientHeight - this.$tip.clientHeight}px)`;
|
|
84
60
|
}
|
|
85
61
|
}
|
|
86
62
|
|
|
@@ -103,18 +79,20 @@ class Popup {
|
|
|
103
79
|
}
|
|
104
80
|
|
|
105
81
|
render(params) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this
|
|
109
|
-
this
|
|
82
|
+
super.render(params);
|
|
83
|
+
|
|
84
|
+
this.$content = this.select(".og-popup-content");
|
|
85
|
+
this.$title = this.select(".og-popup-title");
|
|
86
|
+
this.$tip = this.select(".og-popup-tip-container");
|
|
87
|
+
|
|
110
88
|
this.setOffset(this._offset[0], this._offset[1]);
|
|
111
89
|
this.setContent(this._content);
|
|
112
|
-
this.setTitle(this._title);
|
|
113
90
|
this.setLonLat(this._lonLat);
|
|
114
91
|
this.setVisibility(this._visibility);
|
|
115
|
-
this.
|
|
92
|
+
this.select(".og-popup-close").addEventListener("click", () => {
|
|
116
93
|
this.hide();
|
|
117
94
|
});
|
|
95
|
+
|
|
118
96
|
return this;
|
|
119
97
|
}
|
|
120
98
|
|
|
@@ -128,19 +106,20 @@ class Popup {
|
|
|
128
106
|
}
|
|
129
107
|
|
|
130
108
|
getContainer() {
|
|
131
|
-
return this
|
|
109
|
+
return this.$content;
|
|
132
110
|
}
|
|
133
111
|
|
|
134
112
|
getToolbarContainer() {
|
|
135
|
-
return this.
|
|
113
|
+
return this.select(".og-popup-toolbar");
|
|
136
114
|
}
|
|
137
115
|
|
|
138
116
|
show() {
|
|
139
117
|
this._visibility = true;
|
|
140
118
|
if (this._planet) {
|
|
141
119
|
this._planet.events.on("draw", this._updatePosition, this);
|
|
142
|
-
this._planet.renderer.div
|
|
143
|
-
this.
|
|
120
|
+
this.appendTo(this._planet.renderer.div);
|
|
121
|
+
//this._planet.renderer.div.appendChild(this.el);
|
|
122
|
+
this._events.dispatch(this._events.open, this);
|
|
144
123
|
}
|
|
145
124
|
return this;
|
|
146
125
|
}
|
|
@@ -150,7 +129,7 @@ class Popup {
|
|
|
150
129
|
if (this.el.parentNode) {
|
|
151
130
|
this._planet.events.off("draw", this._updatePosition);
|
|
152
131
|
this.el.parentNode.removeChild(this.el);
|
|
153
|
-
this.
|
|
132
|
+
this._events.dispatch(this._events.close, this);
|
|
154
133
|
}
|
|
155
134
|
return this;
|
|
156
135
|
}
|
|
@@ -177,9 +156,7 @@ class Popup {
|
|
|
177
156
|
}
|
|
178
157
|
|
|
179
158
|
setTitle(html) {
|
|
180
|
-
this.
|
|
181
|
-
this._titleEl.innerHTML = html;
|
|
182
|
-
return this;
|
|
159
|
+
this.$title.innerHTML = html;
|
|
183
160
|
}
|
|
184
161
|
|
|
185
162
|
setLonLat(lonLat) {
|
|
@@ -187,7 +164,6 @@ class Popup {
|
|
|
187
164
|
if (this._planet) {
|
|
188
165
|
this.setCartesian3v(this._planet.ellipsoid.lonLatToCartesian(lonLat), lonLat.height);
|
|
189
166
|
}
|
|
190
|
-
return this;
|
|
191
167
|
}
|
|
192
168
|
|
|
193
169
|
setContent(content) {
|
|
@@ -195,17 +171,16 @@ class Popup {
|
|
|
195
171
|
this.clear();
|
|
196
172
|
this._content = content;
|
|
197
173
|
if (typeof content === "string") {
|
|
198
|
-
this.
|
|
174
|
+
this.$content.innerHTML = content;
|
|
199
175
|
} else {
|
|
200
|
-
this.
|
|
176
|
+
this.$content.appendChild(content);
|
|
201
177
|
}
|
|
202
178
|
}
|
|
203
|
-
return this;
|
|
204
179
|
}
|
|
205
180
|
|
|
206
181
|
clear() {
|
|
207
182
|
this._content = null;
|
|
208
|
-
this.
|
|
183
|
+
this.$content.innerHTML = "";
|
|
209
184
|
}
|
|
210
185
|
}
|
|
211
186
|
|
package/src/og/astro/earth.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as jd from "./jd.js";
|
|
8
7
|
import * as math from "../math.js";
|
|
9
|
-
import * as astro from "./astro.js";
|
|
10
8
|
import { Quat } from "../math/Quat.js";
|
|
11
9
|
import { Vec3 } from "../math/Vec3.js";
|
|
10
|
+
import * as astro from "./astro.js";
|
|
11
|
+
import * as jd from "./jd.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Returns Sun position in the geocentric coordinate system by the time.
|
package/src/og/astro/rotation.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Vec3 } from "../math/Vec3.js";
|
|
8
|
-
import { Mat3 } from "../math/Mat3.js";
|
|
9
7
|
import { PI_TWO } from "../math.js";
|
|
8
|
+
import { Mat3 } from "../math/Mat3.js";
|
|
9
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
10
10
|
|
|
11
11
|
export function getRotationMatrix(rightAscension, declination, res) {
|
|
12
12
|
let xAxis = new Vec3(),
|
package/src/og/bv/Box.js
CHANGED
package/src/og/bv/index.js
CHANGED
package/src/og/camera/Camera.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import * as math from "../math.js";
|
|
4
3
|
import { Events } from "../Events.js";
|
|
5
|
-
import
|
|
4
|
+
import * as math from "../math.js";
|
|
5
|
+
import { Mat3 } from "../math/Mat3.js";
|
|
6
|
+
import { Mat4 } from "../math/Mat4.js";
|
|
6
7
|
import { Vec2 } from "../math/Vec2.js";
|
|
7
8
|
import { Vec3 } from "../math/Vec3.js";
|
|
8
9
|
import { Vec4 } from "../math/Vec4.js";
|
|
9
|
-
import {
|
|
10
|
-
import { Mat4 } from "../math/Mat4.js";
|
|
10
|
+
import { Frustum } from "./Frustum.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Camera class.
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as math from "../math.js";
|
|
8
|
-
import * as mercator from "../mercator.js";
|
|
9
|
-
import { Camera } from "./Camera.js";
|
|
10
|
-
import { Vec3 } from "../math/Vec3.js";
|
|
11
7
|
import { Key } from "../Lock.js";
|
|
12
8
|
import { LonLat } from "../LonLat.js";
|
|
13
|
-
import
|
|
14
|
-
import { Quat } from "../math/Quat.js";
|
|
9
|
+
import * as math from "../math.js";
|
|
15
10
|
import { Mat4 } from "../math/Mat4.js";
|
|
11
|
+
import { Quat } from "../math/Quat.js";
|
|
12
|
+
import { Ray } from "../math/Ray.js";
|
|
13
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
14
|
+
import * as mercator from "../mercator.js";
|
|
15
|
+
import { Camera } from "./Camera.js";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Planet camera.
|
|
@@ -121,6 +121,8 @@ class PlanetCamera extends Camera {
|
|
|
121
121
|
this._completeCallback = null;
|
|
122
122
|
this._flying = false;
|
|
123
123
|
this._checkTerrainCollision = true;
|
|
124
|
+
|
|
125
|
+
this._velCart = new Vec3(0.0,0.0,0.0);
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
setTerrainCollisionActivity(isActive) {
|
|
@@ -657,6 +659,24 @@ class PlanetCamera extends Camera {
|
|
|
657
659
|
let e = this.eye.length();
|
|
658
660
|
return this.eye.distance(poi) < Math.sqrt(e * e - this.planet.ellipsoid._a2);
|
|
659
661
|
}
|
|
662
|
+
|
|
663
|
+
// _calcOrientation() {
|
|
664
|
+
// let qq = Quat.yRotation(this.yaw * RADIANS).mul(this._qNorthFrame).conjugate();
|
|
665
|
+
// this.orientation = qq.mulVec3(MODEL_FORWARD).normalize();
|
|
666
|
+
// this._uOrientation[0] = this.orientation.x;
|
|
667
|
+
// this._uOrientation[1] = this.orientation.y;
|
|
668
|
+
// this._uOrientation[2] = this.orientation.z;
|
|
669
|
+
// }
|
|
670
|
+
//
|
|
671
|
+
// _updatePrediction(now) {
|
|
672
|
+
//
|
|
673
|
+
// this._qNorthFrame = Planet.getBearingNorthRotationQuat(this.eye);
|
|
674
|
+
//
|
|
675
|
+
// let dt = (now - this._positionTime) * 0.001;
|
|
676
|
+
// this._positionTime = now;
|
|
677
|
+
//
|
|
678
|
+
// this._predMapPosCart = this.eye.add(this._velCartesian.scaleTo(dt));
|
|
679
|
+
// }
|
|
660
680
|
}
|
|
661
681
|
|
|
662
682
|
export { PlanetCamera };
|
package/src/og/camera/index.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
7
|
import * as atmos from "../shaders/atmos.js";
|
|
8
|
-
import { Control } from "./Control.js";
|
|
9
|
-
import { Program } from '../webgl/Program.js';
|
|
10
8
|
import { Framebuffer } from "../webgl/index.js";
|
|
9
|
+
import { Program } from '../webgl/Program.js';
|
|
10
|
+
import { Control } from "./Control.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Frame per second(FPS) display control.
|
|
@@ -146,10 +146,6 @@ class Atmosphere extends Control {
|
|
|
146
146
|
|
|
147
147
|
gl.disable(gl.DEPTH_TEST);
|
|
148
148
|
|
|
149
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
150
|
-
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
151
|
-
gl.enable(gl.BLEND);
|
|
152
|
-
|
|
153
149
|
sh.activate();
|
|
154
150
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.renderer.screenFramePositionBuffer);
|
|
155
151
|
gl.vertexAttribPointer(p.attributes.corners, 2, gl.FLOAT, false, 0, 0);
|
|
@@ -174,7 +170,6 @@ class Atmosphere extends Control {
|
|
|
174
170
|
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
175
171
|
|
|
176
172
|
gl.enable(gl.DEPTH_TEST);
|
|
177
|
-
gl.disable(gl.BLEND);
|
|
178
173
|
}
|
|
179
174
|
}
|
|
180
175
|
|
|
@@ -383,7 +378,7 @@ function atmosphereBackgroundShader() {
|
|
|
383
378
|
light += sunLum * SUN_INTENSITY * transmittanceFromCameraToSpace;
|
|
384
379
|
}
|
|
385
380
|
|
|
386
|
-
fragColor = vec4(pow(light * 8.0, vec3(1.0 / 2.2)), opacity);
|
|
381
|
+
fragColor = vec4(pow(light * 8.0, vec3(1.0 / 2.2)), clamp(opacity, 0.0, 1.0));
|
|
387
382
|
}
|
|
388
383
|
|
|
389
384
|
void main(void)
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Control } from "./Control.js";
|
|
4
|
-
import { parseHTML } from "../utils/shared.js";
|
|
5
3
|
import { Button } from "../ui/Button.js";
|
|
6
|
-
import {
|
|
4
|
+
import { Control } from "./Control.js";
|
|
7
5
|
|
|
8
6
|
const ICON_BUTTON_SVG = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
9
7
|
<svg
|
|
@@ -98,10 +96,11 @@ class CompassButton extends Control {
|
|
|
98
96
|
|
|
99
97
|
let btn = new Button({
|
|
100
98
|
classList: ["og-map-button", "og-compass-button"],
|
|
101
|
-
icon: ICON_BUTTON_SVG
|
|
102
|
-
appendTo: this.renderer.div
|
|
99
|
+
icon: ICON_BUTTON_SVG
|
|
103
100
|
});
|
|
104
101
|
|
|
102
|
+
btn.appendTo(this.renderer.div);
|
|
103
|
+
|
|
105
104
|
btn.on("click", this._onClick, this);
|
|
106
105
|
|
|
107
106
|
this._svg = btn.select("svg");
|
|
@@ -41,7 +41,7 @@ class Control {
|
|
|
41
41
|
* @public
|
|
42
42
|
* @type {Boolean}
|
|
43
43
|
*/
|
|
44
|
-
this.autoActivate = options.autoActivate
|
|
44
|
+
this.autoActivate = options.autoActivate || false;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Control activity.
|
|
@@ -76,35 +76,40 @@ class Control {
|
|
|
76
76
|
* @public
|
|
77
77
|
* @virtual
|
|
78
78
|
*/
|
|
79
|
-
oninit() {
|
|
79
|
+
oninit() {
|
|
80
|
+
}
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
83
|
* Control renderer assigning function have to be overriden.
|
|
83
84
|
* @public
|
|
84
85
|
* @virtual
|
|
85
86
|
*/
|
|
86
|
-
onadd() {
|
|
87
|
+
onadd() {
|
|
88
|
+
}
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
91
|
* Control remove function have to be overriden.
|
|
90
92
|
* @public
|
|
91
93
|
* @virtual
|
|
92
94
|
*/
|
|
93
|
-
onremove() {
|
|
95
|
+
onremove() {
|
|
96
|
+
}
|
|
94
97
|
|
|
95
98
|
/**
|
|
96
99
|
* Control activation function have to be overriden.
|
|
97
100
|
* @public
|
|
98
101
|
* @virtual
|
|
99
102
|
*/
|
|
100
|
-
onactivate() {
|
|
103
|
+
onactivate() {
|
|
104
|
+
}
|
|
101
105
|
|
|
102
106
|
/**
|
|
103
107
|
* Control deactivation function have to be overriden.
|
|
104
108
|
* @public
|
|
105
109
|
* @virtual
|
|
106
110
|
*/
|
|
107
|
-
ondeactivate() {
|
|
111
|
+
ondeactivate() {
|
|
112
|
+
}
|
|
108
113
|
|
|
109
114
|
/**
|
|
110
115
|
* Assign renderer to the control.
|
|
@@ -116,9 +121,10 @@ class Control {
|
|
|
116
121
|
this.renderer = renderer;
|
|
117
122
|
renderer.controls[this.name] = this;
|
|
118
123
|
this.onadd && this.onadd();
|
|
124
|
+
this._initialized = true;
|
|
125
|
+
this.oninit && this.oninit();
|
|
119
126
|
if (this.autoActivate) {
|
|
120
|
-
this.
|
|
121
|
-
this.oninit && this.oninit();
|
|
127
|
+
this.activate();
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
}
|
|
@@ -154,12 +160,14 @@ class Control {
|
|
|
154
160
|
* @public
|
|
155
161
|
*/
|
|
156
162
|
activate() {
|
|
157
|
-
if (!this.
|
|
158
|
-
this._initialized
|
|
159
|
-
|
|
163
|
+
if (!this._active) {
|
|
164
|
+
if (!this._initialized) {
|
|
165
|
+
this._initialized = true;
|
|
166
|
+
this.oninit && this.oninit();
|
|
167
|
+
}
|
|
168
|
+
this._active = true;
|
|
169
|
+
this.onactivate && this.onactivate();
|
|
160
170
|
}
|
|
161
|
-
this._active = true;
|
|
162
|
-
this.onactivate && this.onactivate();
|
|
163
171
|
}
|
|
164
172
|
|
|
165
173
|
/**
|
|
@@ -167,8 +175,10 @@ class Control {
|
|
|
167
175
|
* @public
|
|
168
176
|
*/
|
|
169
177
|
deactivate() {
|
|
170
|
-
this._active
|
|
171
|
-
|
|
178
|
+
if (this._active) {
|
|
179
|
+
this._active = false;
|
|
180
|
+
this.ondeactivate && this.ondeactivate();
|
|
181
|
+
}
|
|
172
182
|
}
|
|
173
183
|
|
|
174
184
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
import { LonLat } from '../LonLat.js';
|
|
4
|
+
import { throttle } from '../utils/shared.js';
|
|
3
5
|
import * as units from '../utils/units.js';
|
|
4
6
|
import { heightMode } from '../utils/units.js';
|
|
5
7
|
import { Control } from './Control.js';
|
|
6
|
-
import { throttle } from '../utils/shared.js';
|
|
7
|
-
import { LonLat } from '../LonLat.js';
|
|
8
8
|
|
|
9
9
|
const DECIMAL_TEMPLATE =
|
|
10
10
|
`<div class="og-lat-side"></div><div class="og-lat-val"></div>
|
|
@@ -211,3 +211,4 @@ class EarthCoordinates extends Control {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
export { EarthCoordinates };
|
|
214
|
+
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
|
-
import { Control } from './Control.js';
|
|
8
7
|
import { BaseGeoImage } from '../layer/BaseGeoImage.js';
|
|
9
8
|
import { ToggleButton } from "../ui/ToggleButton.js";
|
|
9
|
+
import { Control } from './Control.js';
|
|
10
10
|
|
|
11
11
|
const ICON_BUTTON_SVG = `<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M16 13l6.964 4.062-2.973.85 2.125 3.681-1.732 1-2.125-3.68-2.223 2.15L16 13zm-2-7h2v2h5a1 1 0 0 1 1 1v4h-2v-3H10v10h4v2H9a1 1 0 0 1-1-1v-5H6v-2h2V9a1 1 0 0 1 1-1h5V6zM4 14v2H2v-2h2zm0-4v2H2v-2h2zm0-4v2H2V6h2zm0-4v2H2V2h2zm4 0v2H6V2h2zm4 0v2h-2V2h2zm4 0v2h-2V2h2z" fill="#000"/></svg>`;
|
|
12
12
|
|
|
@@ -118,4 +118,4 @@ class GeoImageDragControl extends Control {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
export { GeoImageDragControl };
|
|
121
|
+
export { GeoImageDragControl };
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as math from "../math.js";
|
|
8
|
-
import { Control } from "./Control.js";
|
|
9
7
|
import { input } from "../input/input.js";
|
|
8
|
+
import * as math from "../math.js";
|
|
10
9
|
import { Vec3 } from "../math/Vec3.js";
|
|
10
|
+
import { Control } from "./Control.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Planet camera keyboard navigation. Use W,S,A,D and left shift key for fly around a planet.
|
|
@@ -166,3 +166,4 @@ export function keyboardNavigation(options) {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
export { KeyboardNavigation };
|
|
169
|
+
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Control } from "./Control.js";
|
|
8
7
|
import { Events } from '../Events.js';
|
|
8
|
+
import { Control } from "./Control.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
@@ -380,4 +380,4 @@ layerAnimation(options) {
|
|
|
380
380
|
|
|
381
381
|
export {
|
|
382
382
|
LayerAnimation
|
|
383
|
-
};
|
|
383
|
+
};
|