@openglobus/og 0.11.1 → 0.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +18 -20
- package/src/og/Clock.js +11 -11
- package/src/og/Deferred.js +1 -1
- package/src/og/Events.js +9 -7
- package/src/og/Extent.js +117 -72
- package/src/og/Globe.js +35 -22
- package/src/og/ImageCanvas.js +24 -18
- package/src/og/Lock.js +2 -2
- package/src/og/LonLat.js +40 -37
- package/src/og/Popup.js +21 -15
- package/src/og/QueueArray.js +7 -3
- package/src/og/Rectangle.js +11 -6
- package/src/og/Stack.js +8 -5
- package/src/og/ajax.js +21 -33
- package/src/og/astro/astro.js +5 -5
- package/src/og/astro/earth.js +23 -17
- package/src/og/astro/jd.js +44 -39
- package/src/og/astro/orbit.js +20 -18
- package/src/og/astro/rotation.js +17 -8
- package/src/og/bv/Box.js +7 -3
- package/src/og/bv/Sphere.js +17 -9
- package/src/og/camera/Camera.js +137 -86
- package/src/og/camera/Frustum.js +30 -19
- package/src/og/camera/PlanetCamera.js +30 -26
- package/src/og/control/CompassButton.js +8 -2
- package/src/og/control/Control.js +13 -11
- package/src/og/control/DebugInfo.js +4 -1
- package/src/og/control/EarthCoordinates.js +62 -41
- package/src/og/control/EarthNavigation.js +20 -22
- package/src/og/control/GeoImageDragControl.js +1 -1
- package/src/og/control/KeyboardNavigation.js +12 -12
- package/src/og/control/LayerSwitcher.js +24 -23
- package/src/og/control/Lighting.js +1 -1
- package/src/og/control/MouseNavigation.js +1 -1
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/SegmentBoundVisualization.js +8 -9
- package/src/og/control/ShowFps.js +15 -10
- package/src/og/control/SimpleNavigation.js +8 -10
- package/src/og/control/Sun.js +25 -15
- package/src/og/control/ToggleWireframe.js +5 -5
- package/src/og/control/TouchNavigation.js +58 -45
- package/src/og/control/ZoomControl.js +41 -25
- package/src/og/control/index.js +4 -0
- package/src/og/ellipsoid/Ellipsoid.js +181 -85
- package/src/og/ellipsoid/wgs84.js +4 -4
- package/src/og/entity/BaseBillboard.js +97 -44
- package/src/og/entity/Billboard.js +15 -11
- package/src/og/entity/BillboardHandler.js +314 -64
- package/src/og/entity/Entity.js +106 -74
- package/src/og/entity/EntityCollection.js +72 -49
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/Geometry.js +29 -26
- package/src/og/entity/GeometryHandler.js +598 -126
- package/src/og/entity/Label.js +74 -40
- package/src/og/entity/LabelHandler.js +47 -246
- package/src/og/entity/LabelWorker.js +213 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +81 -33
- package/src/og/entity/PointCloudHandler.js +9 -9
- package/src/og/entity/Polyline.js +39 -39
- package/src/og/entity/Ray.js +61 -28
- package/src/og/entity/ShapeHandler.js +1 -1
- package/src/og/entity/Strip.js +77 -48
- package/src/og/entity/StripHandler.js +27 -27
- package/src/og/entity/index.js +8 -16
- package/src/og/input/KeyboardHandler.js +107 -104
- package/src/og/input/MouseHandler.js +81 -78
- package/src/og/input/TouchHandler.js +55 -51
- package/src/og/layer/BaseGeoImage.js +61 -30
- package/src/og/layer/CanvasTiles.js +26 -24
- package/src/og/layer/GeoImage.js +10 -10
- package/src/og/layer/GeoTexture2d.js +1 -1
- package/src/og/layer/GeoVideo.js +3 -3
- package/src/og/layer/KML.js +66 -40
- package/src/og/layer/Layer.js +27 -17
- package/src/og/layer/Material.js +93 -61
- package/src/og/layer/Vector.js +118 -72
- package/src/og/layer/WMS.js +36 -19
- package/src/og/layer/XYZ.js +55 -48
- package/src/og/light/LightSource.js +47 -40
- package/src/og/math/Line2.js +24 -24
- package/src/og/math/Line3.js +103 -102
- package/src/og/math/Mat3.js +134 -121
- package/src/og/math/Mat4.js +603 -459
- package/src/og/math/Plane.js +21 -20
- package/src/og/math/Quat.js +980 -927
- package/src/og/math/Ray.js +195 -187
- package/src/og/math/Vec2.js +127 -117
- package/src/og/math/Vec3.js +206 -176
- package/src/og/math/Vec4.js +49 -53
- package/src/og/math/coder.js +18 -18
- package/src/og/math.js +12 -12
- package/src/og/mercator.js +11 -11
- package/src/og/proj/EPSG3857.js +4 -4
- package/src/og/proj/EPSG4326.js +4 -4
- package/src/og/proj/Proj.js +31 -31
- package/src/og/quadTree/EntityCollectionNode.js +310 -300
- package/src/og/quadTree/Node.js +1008 -993
- package/src/og/renderer/Renderer.js +768 -747
- package/src/og/renderer/RendererEvents.js +9 -6
- package/src/og/scene/Axes.js +1 -1
- package/src/og/scene/BaseNode.js +8 -9
- package/src/og/scene/Planet.js +115 -87
- package/src/og/scene/RenderNode.js +29 -22
- package/src/og/scene/SkyBox.js +1 -1
- package/src/og/segment/Segment.js +1886 -1878
- package/src/og/segment/SegmentLonLat.js +298 -268
- package/src/og/segment/segmentHelper.js +11 -11
- package/src/og/shaders/bloom.js +1 -1
- package/src/og/shaders/blur.js +2 -2
- package/src/og/shaders/depth.js +1 -1
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/label.js +1 -1
- package/src/og/shaders/lumFilter.js +1 -1
- package/src/og/shaders/pointCloud.js +42 -42
- package/src/og/shaders/screenFrame.js +1 -1
- package/src/og/shaders/shape.js +15 -21
- package/src/og/shaders/skybox.js +37 -37
- package/src/og/shaders/toneMapping.js +1 -1
- package/src/og/shapes/BaseShape.js +129 -57
- package/src/og/shapes/Icosphere.js +30 -15
- package/src/og/shapes/Sphere.js +13 -16
- package/src/og/terrain/BilTerrain.js +2 -1
- package/src/og/terrain/EmptyTerrain.js +2 -2
- package/src/og/terrain/Geoid.js +2 -2
- package/src/og/terrain/GlobusTerrain.js +10 -10
- package/src/og/terrain/MapboxTerrain.js +1 -1
- package/src/og/utils/GeoImageCreator.js +9 -9
- package/src/og/utils/Loader.js +6 -6
- package/src/og/utils/NormalMapCreator.js +13 -13
- package/src/og/utils/TerrainWorker.js +1 -1
- package/src/og/utils/TextureAtlas.js +20 -22
- package/src/og/utils/VectorTileCreator.js +5 -5
- package/src/og/utils/earcut.js +1 -1
- package/src/og/utils/shared.js +15 -15
- package/src/og/webgl/Framebuffer.js +101 -53
- package/src/og/webgl/Handler.js +125 -85
- package/src/og/webgl/Multisample.js +55 -27
- package/src/og/webgl/Program.js +80 -35
- package/src/og/webgl/ProgramController.js +27 -23
- package/src/og/webgl/callbacks.js +8 -8
- package/types/Clock.d.ts +6 -2
- package/types/Deferred.d.ts +1 -1
- package/types/Events.d.ts +8 -4
- package/types/Extent.d.ts +37 -33
- package/types/Globe.d.ts +15 -13
- package/types/ImageCanvas.d.ts +5 -3
- package/types/LonLat.d.ts +24 -24
- package/types/Popup.d.ts +4 -0
- package/types/QueueArray.d.ts +6 -2
- package/types/Rectangle.d.ts +10 -4
- package/types/Stack.d.ts +4 -0
- package/types/ajax.d.ts +1 -1
- package/types/astro/earth.d.ts +3 -2
- package/types/bv/Box.d.ts +10 -5
- package/types/bv/Sphere.d.ts +13 -7
- package/types/camera/Camera.d.ts +90 -81
- package/types/camera/Frustum.d.ts +26 -22
- package/types/camera/PlanetCamera.d.ts +49 -53
- package/types/control/CompassButton.d.ts +4 -4
- package/types/control/Control.d.ts +7 -4
- package/types/control/DebugInfo.d.ts +3 -4
- package/types/control/EarthCoordinates.d.ts +6 -6
- package/types/control/EarthNavigation.d.ts +42 -0
- package/types/control/KeyboardNavigation.d.ts +3 -4
- package/types/control/LayerSwitcher.d.ts +3 -5
- package/types/control/Lighting.d.ts +3 -3
- package/types/control/MouseNavigation.d.ts +47 -0
- package/types/control/ScaleControl.d.ts +3 -3
- package/types/control/ShowFps.d.ts +3 -4
- package/types/control/SimpleNavigation.d.ts +3 -6
- package/types/control/Sun.d.ts +8 -10
- package/types/control/ToggleWireframe.d.ts +3 -3
- package/types/control/TouchNavigation.d.ts +48 -0
- package/types/control/ZoomControl.d.ts +3 -4
- package/types/control/index.d.ts +3 -1
- package/types/ellipsoid/Ellipsoid.d.ts +47 -43
- package/types/ellipsoid/wgs84.d.ts +3 -2
- package/types/entity/BaseBillboard.d.ts +41 -34
- package/types/entity/Billboard.d.ts +7 -7
- package/types/entity/BillboardHandler.d.ts +4 -0
- package/types/entity/Entity.d.ts +101 -83
- package/types/entity/EntityCollection.d.ts +57 -43
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +77 -0
- package/types/entity/Geometry.d.ts +9 -7
- package/types/entity/GeometryHandler.d.ts +2 -2
- package/types/entity/Label.d.ts +24 -29
- package/types/entity/LabelHandler.d.ts +9 -2
- package/types/entity/LabelWorker.d.ts +9 -0
- package/types/entity/PointCloud.d.ts +8 -8
- package/types/entity/PointCloudHandler.d.ts +3 -3
- package/types/entity/Polyline.d.ts +58 -55
- package/types/entity/Ray.d.ts +19 -18
- package/types/entity/Strip.d.ts +8 -7
- package/types/entity/StripHandler.d.ts +3 -3
- package/types/entity/index.d.ts +7 -7
- package/types/input/KeyboardHandler.d.ts +10 -0
- package/types/input/MouseHandler.d.ts +5 -0
- package/types/input/TouchHandler.d.ts +5 -0
- package/types/layer/BaseGeoImage.d.ts +23 -35
- package/types/layer/CanvasTiles.d.ts +15 -22
- package/types/layer/GeoImage.d.ts +5 -18
- package/types/layer/GeoVideo.d.ts +5 -30
- package/types/layer/KML.d.ts +20 -15
- package/types/layer/Layer.d.ts +326 -0
- package/types/layer/Material.d.ts +45 -0
- package/types/layer/Vector.d.ts +208 -0
- package/types/layer/WMS.d.ts +4 -7
- package/types/layer/XYZ.d.ts +19 -25
- package/types/light/LightSource.d.ts +54 -53
- package/types/math/Line2.d.ts +11 -0
- package/types/math/Line3.d.ts +10 -0
- package/types/math/Mat3.d.ts +30 -18
- package/types/math/Mat4.d.ts +71 -52
- package/types/math/Plane.d.ts +5 -4
- package/types/math/Quat.d.ts +379 -0
- package/types/math/Ray.d.ts +82 -0
- package/types/math/Vec2.d.ts +102 -101
- package/types/math/Vec3.d.ts +143 -142
- package/types/math/Vec4.d.ts +40 -39
- package/types/math/coder.d.ts +12 -11
- package/types/math.d.ts +8 -8
- package/types/mercator.d.ts +3 -3
- package/types/proj/EPSG3857.d.ts +3 -2
- package/types/proj/EPSG4326.d.ts +3 -2
- package/types/proj/Proj.d.ts +42 -0
- package/types/quadTree/EntityCollectionNode.d.ts +34 -0
- package/types/quadTree/Node.d.ts +61 -0
- package/types/renderer/Renderer.d.ts +300 -0
- package/types/renderer/RendererEvents.d.ts +10 -7
- package/types/scene/BaseNode.d.ts +9 -9
- package/types/scene/Planet.d.ts +131 -126
- package/types/scene/RenderNode.d.ts +22 -23
- package/types/segment/Segment.d.ts +279 -0
- package/types/segment/SegmentLonLat.d.ts +16 -0
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shapes/BaseShape.d.ts +43 -40
- package/types/shapes/Sphere.d.ts +7 -7
- package/types/terrain/BilTerrain.d.ts +0 -1
- package/types/terrain/EmptyTerrain.d.ts +4 -4
- package/types/terrain/GlobusTerrain.d.ts +17 -54
- package/types/terrain/MapboxTerrain.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +3 -2
- package/types/utils/TextureAtlas.d.ts +8 -8
- package/types/utils/shared.d.ts +25 -24
- package/types/webgl/Framebuffer.d.ts +5 -5
- package/types/webgl/Handler.d.ts +68 -43
- package/types/webgl/Multisample.d.ts +5 -5
- package/types/webgl/Program.d.ts +8 -2
- package/types/webgl/ProgramController.d.ts +18 -13
- package/src/og/inherits.js +0 -8
- package/src/og/utils/polylabel.js +0 -176
- package/types/inherits.d.ts +0 -4
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { Control } from "./Control.js";
|
|
5
|
-
import { input } from "../input/input.js";
|
|
6
|
-
import { Key } from "../Lock.js";
|
|
3
|
+
import { Sphere } from "../bv/Sphere.js";
|
|
7
4
|
import { LonLat } from "../LonLat.js";
|
|
8
|
-
import { Mat4 } from "../math/Mat4.js";
|
|
9
5
|
import { Quat } from "../math/Quat.js";
|
|
10
6
|
import { Ray } from "../math/Ray.js";
|
|
11
|
-
import { Sphere } from "../bv/Sphere.js";
|
|
12
7
|
import { Vec3 } from "../math/Vec3.js";
|
|
8
|
+
import { Control } from "./Control.js";
|
|
9
|
+
|
|
10
|
+
class Touch {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.x = 0;
|
|
13
|
+
this.y = 0;
|
|
14
|
+
this.prev_x = 0;
|
|
15
|
+
this.prev_y = 0;
|
|
16
|
+
this.grabbedPoint = new Vec3();
|
|
17
|
+
this.grabbedSpheroid = new Sphere();
|
|
18
|
+
this.dX = function () {
|
|
19
|
+
return this.x - this.prev_x;
|
|
20
|
+
};
|
|
21
|
+
this.dY = function () {
|
|
22
|
+
return this.y - this.prev_y;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
13
26
|
|
|
14
27
|
class EarthNavigation extends Control {
|
|
15
28
|
constructor(options) {
|
|
@@ -33,21 +46,6 @@ class EarthNavigation extends Control {
|
|
|
33
46
|
{ h: 500000, max: 0.99, min: -0.99 }
|
|
34
47
|
];
|
|
35
48
|
|
|
36
|
-
var Touch = function () {
|
|
37
|
-
this.x = 0;
|
|
38
|
-
this.y = 0;
|
|
39
|
-
this.prev_x = 0;
|
|
40
|
-
this.prev_y = 0;
|
|
41
|
-
this.grabbedPoint = new Vec3();
|
|
42
|
-
this.grabbedSpheroid = new Sphere();
|
|
43
|
-
this.dX = function () {
|
|
44
|
-
return this.x - this.prev_x;
|
|
45
|
-
};
|
|
46
|
-
this.dY = function () {
|
|
47
|
-
return this.y - this.prev_y;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
|
|
51
49
|
this.touches = [new Touch(), new Touch()];
|
|
52
50
|
}
|
|
53
51
|
|
|
@@ -70,7 +68,7 @@ class EarthNavigation extends Control {
|
|
|
70
68
|
|
|
71
69
|
var ll = this.renderer.activeCamera._lonLat;
|
|
72
70
|
|
|
73
|
-
|
|
71
|
+
this.planet.flyLonLat(new LonLat(ll.lon, ll.lat, this.positionState[this.currState].h));
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
onMouseWheel(event) {
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* @module og/control/KeyboardNavigation
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as math from
|
|
8
|
-
import { Control } from
|
|
9
|
-
import { input } from
|
|
10
|
-
import { Vec3 } from
|
|
7
|
+
import * as math from "../math.js";
|
|
8
|
+
import { Control } from "./Control.js";
|
|
9
|
+
import { input } from "../input/input.js";
|
|
10
|
+
import { Vec3 } from "../math/Vec3.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.
|
|
14
14
|
* @class
|
|
15
|
-
* @extends {
|
|
15
|
+
* @extends {Control}
|
|
16
16
|
* @param {Object} [options] - Control options.
|
|
17
17
|
*/
|
|
18
18
|
|
|
@@ -69,7 +69,7 @@ class KeyboardNavigation extends Control {
|
|
|
69
69
|
if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
|
|
70
70
|
cam.pitch(15 / this.renderer.handler.deltaTime);
|
|
71
71
|
} else {
|
|
72
|
-
cam.rotateVertical(cam._lonLat.height / 3000000 * math.RADIANS, Vec3.ZERO);
|
|
72
|
+
cam.rotateVertical((cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
|
|
73
73
|
}
|
|
74
74
|
cam.update();
|
|
75
75
|
}
|
|
@@ -79,7 +79,7 @@ class KeyboardNavigation extends Control {
|
|
|
79
79
|
if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
|
|
80
80
|
cam.pitch(-15 / this.renderer.handler.deltaTime);
|
|
81
81
|
} else {
|
|
82
|
-
cam.rotateVertical(-cam._lonLat.height / 3000000 * math.RADIANS, Vec3.ZERO);
|
|
82
|
+
cam.rotateVertical((-cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
|
|
83
83
|
}
|
|
84
84
|
cam.update();
|
|
85
85
|
}
|
|
@@ -89,7 +89,7 @@ class KeyboardNavigation extends Control {
|
|
|
89
89
|
if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
|
|
90
90
|
cam.yaw(15 / this.renderer.handler.deltaTime);
|
|
91
91
|
} else {
|
|
92
|
-
cam.rotateHorizontal(cam._lonLat.height / 3000000 * math.RADIANS, false, Vec3.ZERO);
|
|
92
|
+
cam.rotateHorizontal((cam._lonLat.height / 3000000) * math.RADIANS, false, Vec3.ZERO);
|
|
93
93
|
}
|
|
94
94
|
cam.update();
|
|
95
95
|
}
|
|
@@ -99,7 +99,7 @@ class KeyboardNavigation extends Control {
|
|
|
99
99
|
if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
|
|
100
100
|
cam.yaw(-15 / this.renderer.handler.deltaTime);
|
|
101
101
|
} else {
|
|
102
|
-
cam.rotateHorizontal(-cam._lonLat.height / 3000000 * math.RADIANS, false, Vec3.ZERO);
|
|
102
|
+
cam.rotateHorizontal((-cam._lonLat.height / 3000000) * math.RADIANS, false, Vec3.ZERO);
|
|
103
103
|
}
|
|
104
104
|
cam.update();
|
|
105
105
|
}
|
|
@@ -113,10 +113,10 @@ class KeyboardNavigation extends Control {
|
|
|
113
113
|
this.renderer.activeCamera.roll(15 / this.renderer.handler.deltaTime);
|
|
114
114
|
this.renderer.activeCamera.update();
|
|
115
115
|
}
|
|
116
|
-
}
|
|
116
|
+
}
|
|
117
117
|
|
|
118
118
|
export function keyboardNavigation(options) {
|
|
119
119
|
return new KeyboardNavigation(options);
|
|
120
|
-
}
|
|
120
|
+
}
|
|
121
121
|
|
|
122
122
|
export { KeyboardNavigation };
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* @module og/control/LayerSwitcher
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Control } from
|
|
7
|
+
import { Control } from "./Control.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Simple(OpenLayers like)layer switcher, includes base layers, overlays, geo images etc. groups.
|
|
11
11
|
* @class
|
|
12
|
-
* @extends {
|
|
12
|
+
* @extends {Control}
|
|
13
13
|
* @param {Object} [options] - Control options.
|
|
14
14
|
*/
|
|
15
15
|
class LayerSwitcher extends Control {
|
|
@@ -48,7 +48,7 @@ class LayerSwitcher extends Control {
|
|
|
48
48
|
this.addSwitcher("checkbox", layer, this.overlaysDiv, this._id);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
52
|
|
|
53
53
|
onLayerRemoved(layer) {
|
|
54
54
|
layer._removeCallback();
|
|
@@ -56,16 +56,16 @@ class LayerSwitcher extends Control {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
addSwitcher(type, obj, container, id) {
|
|
59
|
-
var lineDiv = document.createElement(
|
|
59
|
+
var lineDiv = document.createElement("div");
|
|
60
60
|
|
|
61
61
|
var that = this;
|
|
62
|
-
var center = document.createElement(
|
|
63
|
-
center.classList.add(
|
|
62
|
+
var center = document.createElement("div");
|
|
63
|
+
center.classList.add("ogViewExtentBtn");
|
|
64
64
|
center.onclick = function () {
|
|
65
65
|
that.planet.flyExtent(obj.getExtent());
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
var inp = document.createElement(
|
|
68
|
+
var inp = document.createElement("input");
|
|
69
69
|
inp.type = type;
|
|
70
70
|
inp.name = "ogBaseLayerRadiosId" + (id || "");
|
|
71
71
|
inp.checked = obj.getVisibility();
|
|
@@ -74,11 +74,12 @@ class LayerSwitcher extends Control {
|
|
|
74
74
|
obj.setVisibility(this.checked);
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
obj.events &&
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
obj.events &&
|
|
78
|
+
obj.events.on("visibilitychange", function (e) {
|
|
79
|
+
inp.checked = e.getVisibility();
|
|
80
|
+
});
|
|
80
81
|
|
|
81
|
-
var lbl = document.createElement(
|
|
82
|
+
var lbl = document.createElement("label");
|
|
82
83
|
lbl.className = "ogLayerSwitcherLabel";
|
|
83
84
|
lbl.innerHTML = (obj.name || obj.src || "noname") + "</br>";
|
|
84
85
|
|
|
@@ -94,35 +95,35 @@ class LayerSwitcher extends Control {
|
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
createBaseLayersContainer() {
|
|
97
|
-
var layersDiv = document.createElement(
|
|
98
|
+
var layersDiv = document.createElement("div");
|
|
98
99
|
layersDiv.className = "layersDiv";
|
|
99
100
|
this.dialog.appendChild(layersDiv);
|
|
100
101
|
|
|
101
|
-
var baseLayersLbl = document.createElement(
|
|
102
|
+
var baseLayersLbl = document.createElement("div");
|
|
102
103
|
baseLayersLbl.className = "layersDiv";
|
|
103
104
|
baseLayersLbl.innerHTML = "Base Layer";
|
|
104
105
|
layersDiv.appendChild(baseLayersLbl);
|
|
105
106
|
|
|
106
|
-
this.baseLayersDiv = document.createElement(
|
|
107
|
+
this.baseLayersDiv = document.createElement("div");
|
|
107
108
|
layersDiv.appendChild(this.baseLayersDiv);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
createOverlaysContainer() {
|
|
111
|
-
var overlaysDiv = document.createElement(
|
|
112
|
+
var overlaysDiv = document.createElement("div");
|
|
112
113
|
overlaysDiv.className = "layersDiv";
|
|
113
114
|
this.dialog.appendChild(overlaysDiv);
|
|
114
115
|
|
|
115
|
-
var overlaysLbl = document.createElement(
|
|
116
|
+
var overlaysLbl = document.createElement("div");
|
|
116
117
|
overlaysLbl.className = "layersDiv";
|
|
117
118
|
overlaysLbl.innerHTML = "Overlays";
|
|
118
119
|
overlaysDiv.appendChild(overlaysLbl);
|
|
119
120
|
|
|
120
|
-
this.overlaysDiv = document.createElement(
|
|
121
|
+
this.overlaysDiv = document.createElement("div");
|
|
121
122
|
overlaysDiv.appendChild(this.overlaysDiv);
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
createDialog() {
|
|
125
|
-
this.dialog = document.createElement(
|
|
126
|
+
this.dialog = document.createElement("div");
|
|
126
127
|
this.dialog.id = "ogLayerSwitcherDialog";
|
|
127
128
|
this.dialog.className = "displayNone";
|
|
128
129
|
this.renderer.div.appendChild(this.dialog);
|
|
@@ -138,8 +139,8 @@ class LayerSwitcher extends Control {
|
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
createSwitcher() {
|
|
141
|
-
var button = document.createElement(
|
|
142
|
-
button.className =
|
|
142
|
+
var button = document.createElement("div");
|
|
143
|
+
button.className = "ogLayerSwitcherButton";
|
|
143
144
|
button.id = "ogLayerSwitcherButtonMaximize";
|
|
144
145
|
var that = this;
|
|
145
146
|
button.onclick = function (e) {
|
|
@@ -153,6 +154,6 @@ class LayerSwitcher extends Control {
|
|
|
153
154
|
};
|
|
154
155
|
this.renderer.div.appendChild(button);
|
|
155
156
|
}
|
|
156
|
-
}
|
|
157
|
+
}
|
|
157
158
|
|
|
158
|
-
export { LayerSwitcher };
|
|
159
|
+
export { LayerSwitcher };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Control } from
|
|
4
|
-
import { EntityCollection } from
|
|
5
|
-
import { Entity } from
|
|
3
|
+
import { Control } from "./Control.js";
|
|
4
|
+
import { EntityCollection } from "../entity/EntityCollection.js";
|
|
5
|
+
import { Entity } from "../entity/Entity.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Frame per second(FPS) display control.
|
|
9
9
|
* @class
|
|
10
|
-
* @extends {
|
|
10
|
+
* @extends {Control}
|
|
11
11
|
* @param {Object} [options] - Control options.
|
|
12
12
|
*/
|
|
13
13
|
class SegmentBoundVisualization extends Control {
|
|
@@ -18,7 +18,6 @@ class SegmentBoundVisualization extends Control {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
oninit() {
|
|
21
|
-
|
|
22
21
|
this.planet.addEntityCollection(this._boundingSphereCollection);
|
|
23
22
|
|
|
24
23
|
this.renderer.events.on("draw", this._predraw, this);
|
|
@@ -28,7 +27,7 @@ class SegmentBoundVisualization extends Control {
|
|
|
28
27
|
_predraw() {
|
|
29
28
|
this._boundingSphereCollection.clear();
|
|
30
29
|
}
|
|
31
|
-
|
|
30
|
+
|
|
32
31
|
_draw() {
|
|
33
32
|
for (let i = 0; i < this.planet._renderedNodes.length; i++) {
|
|
34
33
|
let si = this.planet._renderedNodes[i].segment;
|
|
@@ -46,10 +45,10 @@ class SegmentBoundVisualization extends Control {
|
|
|
46
45
|
this._boundingSphereCollection.add(si._sphereEntity);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
}
|
|
48
|
+
}
|
|
50
49
|
|
|
51
50
|
export function segmentBoundVisualization(options) {
|
|
52
51
|
return new SegmentBoundVisualization(options);
|
|
53
|
-
}
|
|
52
|
+
}
|
|
54
53
|
|
|
55
54
|
export { SegmentBoundVisualization };
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* @module og/control/ShowFps
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Control } from
|
|
8
|
-
import { print2d } from
|
|
7
|
+
import { Control } from "./Control.js";
|
|
8
|
+
import { print2d } from "../utils/shared.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Frame per second(FPS) display control.
|
|
12
12
|
* @class
|
|
13
|
-
* @extends {
|
|
13
|
+
* @extends {Control}
|
|
14
14
|
* @param {Object} [options] - Control options.
|
|
15
15
|
*/
|
|
16
16
|
class ShowFps extends Control {
|
|
@@ -19,20 +19,25 @@ class ShowFps extends Control {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
oninit() {
|
|
22
|
-
var d = document.createElement(
|
|
23
|
-
d.className =
|
|
22
|
+
var d = document.createElement("div");
|
|
23
|
+
d.className = "defaultText ";
|
|
24
24
|
d.id = "ogShowFpsControl";
|
|
25
25
|
document.body.appendChild(d);
|
|
26
26
|
this.renderer.events.on("draw", this._draw, this);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
_draw() {
|
|
30
|
-
print2d(
|
|
30
|
+
print2d(
|
|
31
|
+
"ogShowFpsControl",
|
|
32
|
+
(1000.0 / this.renderer.handler.deltaTime).toFixed(1),
|
|
33
|
+
this.renderer.handler.canvas.clientWidth - 60,
|
|
34
|
+
0
|
|
35
|
+
);
|
|
31
36
|
}
|
|
32
|
-
}
|
|
37
|
+
}
|
|
33
38
|
|
|
34
39
|
export function showFps(options) {
|
|
35
40
|
return new ShowFps(options);
|
|
36
|
-
}
|
|
41
|
+
}
|
|
37
42
|
|
|
38
43
|
export { ShowFps };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Control } from
|
|
4
|
-
import { input } from
|
|
3
|
+
import { Control } from "./Control.js";
|
|
4
|
+
import { input } from "../input/input.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Simple keyboard camera navigation with W,S,A,D and shift keys to fly around the scene.
|
|
8
8
|
* @class
|
|
9
|
-
* @extends {
|
|
9
|
+
* @extends {Control}
|
|
10
10
|
* @param {Object} [options] - Control options.
|
|
11
11
|
*/
|
|
12
12
|
class SimpleNavigation extends Control {
|
|
@@ -18,11 +18,9 @@ class SimpleNavigation extends Control {
|
|
|
18
18
|
this.speed = options.speed || 1.0;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
onactivate() {
|
|
22
|
-
}
|
|
21
|
+
onactivate() {}
|
|
23
22
|
|
|
24
|
-
ondeactivate() {
|
|
25
|
-
}
|
|
23
|
+
ondeactivate() {}
|
|
26
24
|
|
|
27
25
|
oninit() {
|
|
28
26
|
this.camera = this.renderer.activeCamera;
|
|
@@ -117,13 +115,13 @@ class SimpleNavigation extends Control {
|
|
|
117
115
|
cam.update();
|
|
118
116
|
}
|
|
119
117
|
}
|
|
120
|
-
}
|
|
118
|
+
}
|
|
121
119
|
|
|
122
120
|
/**
|
|
123
121
|
* Creates simple navigation control instance.
|
|
124
122
|
*/
|
|
125
123
|
export function simpleNavigation(options) {
|
|
126
124
|
return new SimpleNavigation(options);
|
|
127
|
-
}
|
|
125
|
+
}
|
|
128
126
|
|
|
129
127
|
export { SimpleNavigation };
|
package/src/og/control/Sun.js
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* @module og/control/Sun
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Control } from
|
|
8
|
-
import { getSunPosition } from
|
|
9
|
-
import { LightSource } from
|
|
10
|
-
import { Quat } from
|
|
11
|
-
import { Vec3 } from
|
|
7
|
+
import { Control } from "./Control.js";
|
|
8
|
+
import { getSunPosition } from "../astro/earth.js";
|
|
9
|
+
import { LightSource } from "../light/LightSource.js";
|
|
10
|
+
import { Quat } from "../math/Quat.js";
|
|
11
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
12
12
|
|
|
13
13
|
const ACTIVATION_HEIGHT = 12079000.0;
|
|
14
14
|
/**
|
|
15
15
|
* Real Sun geocentric position control that place the Sun on the right place by the Earth.
|
|
16
16
|
* @class
|
|
17
|
-
* @extends {
|
|
17
|
+
* @extends {Control}
|
|
18
18
|
* @param {Object} [options] - Control options.
|
|
19
19
|
*/
|
|
20
20
|
class Sun extends Control {
|
|
@@ -28,7 +28,7 @@ class Sun extends Control {
|
|
|
28
28
|
/**
|
|
29
29
|
* Earth planet node.
|
|
30
30
|
* @public
|
|
31
|
-
* @type {
|
|
31
|
+
* @type {Planet}
|
|
32
32
|
*/
|
|
33
33
|
this.planet = null;
|
|
34
34
|
|
|
@@ -46,7 +46,7 @@ class Sun extends Control {
|
|
|
46
46
|
/**
|
|
47
47
|
* Light source.
|
|
48
48
|
* @public
|
|
49
|
-
* @type {
|
|
49
|
+
* @type {LightSource}
|
|
50
50
|
*/
|
|
51
51
|
this.sunlight = null;
|
|
52
52
|
|
|
@@ -72,7 +72,6 @@ class Sun extends Control {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
oninit() {
|
|
75
|
-
|
|
76
75
|
this.planet.lightEnabled = true;
|
|
77
76
|
|
|
78
77
|
// sunlight initialization
|
|
@@ -120,12 +119,17 @@ class Sun extends Control {
|
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
var tu = Vec3.proj_b_to_plane(u, n, u).normalize().scale(this.offsetVertical);
|
|
123
|
-
var tr = Vec3.proj_b_to_plane(cam._u, n, cam._u)
|
|
122
|
+
var tr = Vec3.proj_b_to_plane(cam._u, n, cam._u)
|
|
123
|
+
.normalize()
|
|
124
|
+
.scale(this.offsetHorizontal); // right
|
|
124
125
|
var d = tu.add(tr);
|
|
125
126
|
var pos = cam.eye.add(d);
|
|
126
127
|
if (this._k > 0) {
|
|
127
128
|
this._k -= 0.01;
|
|
128
|
-
let rot = Quat.getRotationBetweenVectors(
|
|
129
|
+
let rot = Quat.getRotationBetweenVectors(
|
|
130
|
+
this.sunlight._position.normal(),
|
|
131
|
+
pos.normal()
|
|
132
|
+
);
|
|
129
133
|
let r = rot.slerp(Quat.IDENTITY, this._k).normalize();
|
|
130
134
|
this.sunlight.setPosition3v(r.mulVec3(this.sunlight._position));
|
|
131
135
|
} else {
|
|
@@ -135,11 +139,17 @@ class Sun extends Control {
|
|
|
135
139
|
this._k = 1;
|
|
136
140
|
if (this._f > 0) {
|
|
137
141
|
this._f -= 0.01;
|
|
138
|
-
let rot = Quat.getRotationBetweenVectors(
|
|
142
|
+
let rot = Quat.getRotationBetweenVectors(
|
|
143
|
+
this.sunlight._position.normal(),
|
|
144
|
+
getSunPosition(this._currDate).normal()
|
|
145
|
+
);
|
|
139
146
|
let r = rot.slerp(Quat.IDENTITY, this._f).normalize();
|
|
140
147
|
this.sunlight.setPosition3v(r.mulVec3(this.sunlight._position));
|
|
141
148
|
} else {
|
|
142
|
-
if (
|
|
149
|
+
if (
|
|
150
|
+
(Math.abs(this._currDate - this._prevDate) > 0.00034 && this._active) ||
|
|
151
|
+
this._lightOn
|
|
152
|
+
) {
|
|
143
153
|
this._lightOn = false;
|
|
144
154
|
this._prevDate = this._currDate;
|
|
145
155
|
this.sunlight.setPosition3v(getSunPosition(this._currDate));
|
|
@@ -157,4 +167,4 @@ export function sun(options) {
|
|
|
157
167
|
return Sun(options);
|
|
158
168
|
}
|
|
159
169
|
|
|
160
|
-
export { Sun };
|
|
170
|
+
export { Sun };
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* @module og/control/ToggleWireframe
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Control } from
|
|
8
|
-
import { input } from
|
|
7
|
+
import { Control } from "./Control.js";
|
|
8
|
+
import { input } from "../input/input.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Planet GL draw mode(TRIANGLE_STRIP/LINE_STRING) changer.
|
|
12
12
|
* @class
|
|
13
|
-
* @extends {
|
|
13
|
+
* @extends {Control}
|
|
14
14
|
* @param {Object} [options] - Control options.
|
|
15
15
|
*/
|
|
16
16
|
class ToggleWireframe extends Control {
|
|
@@ -33,6 +33,6 @@ class ToggleWireframe extends Control {
|
|
|
33
33
|
this.planet.setDrawMode(this.renderer.handler.gl.LINE_STRIP);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
|
|
38
38
|
export { ToggleWireframe };
|