@openglobus/og 0.14.10 → 0.15.1
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/css/og.css +378 -275
- 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 +18 -17
- package/src/og/Clock.js +218 -194
- package/src/og/Globe.js +5 -5
- package/src/og/Object3d.js +104 -145
- package/src/og/camera/Camera.js +31 -27
- package/src/og/camera/PlanetCamera.js +22 -14
- package/src/og/cons.js +107 -107
- package/src/og/control/Atmosphere.js +396 -0
- package/src/og/control/CompassButton.js +11 -18
- package/src/og/control/Control.js +197 -188
- package/src/og/control/GeoImageDragControl.js +84 -66
- package/src/og/control/LayerSwitcher.js +56 -138
- package/src/og/control/Lighting.js +314 -186
- package/src/og/control/MouseNavigation.js +2 -2
- package/src/og/control/RulerSwitcher.js +24 -19
- package/src/og/control/ScaleControl.js +30 -10
- package/src/og/control/SimpleSkyBackground.js +210 -0
- package/src/og/control/Sun.js +3 -1
- package/src/og/control/ZoomControl.js +30 -42
- package/src/og/control/index.js +6 -0
- package/src/og/control/ruler/RulerScene.js +5 -23
- package/src/og/control/selection/Selection.js +99 -0
- package/src/og/control/selection/SelectionScene.js +350 -0
- package/src/og/control/timeline/TimelineControl.js +99 -0
- package/src/og/control/timeline/TimelineModel.js +133 -0
- package/src/og/control/timeline/TimelineView.js +449 -0
- package/src/og/control/timeline/timelineUtils.js +132 -0
- package/src/og/ellipsoid/Ellipsoid.js +120 -93
- package/src/og/ellipsoid/wgs84.js +13 -13
- package/src/og/entity/Entity.js +36 -9
- package/src/og/entity/EntityCollection.js +0 -2
- package/src/og/entity/GeoObject.js +72 -56
- package/src/og/entity/GeoObjectHandler.js +487 -656
- package/src/og/entity/GeometryHandler.js +1341 -1337
- package/src/og/entity/Polyline.js +0 -16
- package/src/og/entity/Ray.js +0 -10
- package/src/og/entity/RayHandler.js +3 -44
- package/src/og/entity/Strip.js +1 -6
- package/src/og/index.js +13 -7
- package/src/og/input/input.js +3 -1
- package/src/og/layer/CanvasTiles.js +39 -34
- package/src/og/layer/Layer.js +69 -9
- package/src/og/layer/Material.js +1 -8
- package/src/og/layer/WMS.js +16 -5
- package/src/og/light/LightSource.js +2 -0
- package/src/og/math/Line3.js +140 -139
- package/src/og/math/Plane.js +118 -117
- package/src/og/math/Ray.js +242 -239
- package/src/og/math/Vec3.js +56 -37
- package/src/og/math/Vec4.js +3 -4
- package/src/og/math.js +21 -21
- package/src/og/quadTree/Node.js +5 -4
- package/src/og/quadTree/index.js +12 -0
- package/src/og/renderer/Renderer.js +64 -37
- package/src/og/renderer/RendererEvents.js +1071 -1065
- package/src/og/scene/Planet.js +354 -174
- package/src/og/scene/RenderNode.js +27 -12
- package/src/og/segment/Segment.js +0 -5
- package/src/og/shaders/atmos.js +332 -0
- package/src/og/shaders/drawnode.js +475 -109
- package/src/og/shaders/geoObject.js +96 -51
- package/src/og/shaders/polyline.js +212 -17
- package/src/og/shaders/ray.js +13 -6
- package/src/og/shaders/toneMapping.js +5 -5
- package/src/og/shaders/utils.js +88 -0
- package/src/og/terrain/GlobusTerrain.js +5 -4
- package/src/og/terrain/MapboxTerrain.js +231 -52
- package/src/og/ui/Button.js +106 -0
- package/src/og/ui/ButtonGroup.js +57 -0
- package/src/og/ui/Dialog.js +242 -0
- package/src/og/ui/Slider.js +144 -0
- package/src/og/ui/ToggleButton.js +51 -0
- package/src/og/{control → ui}/UIhelpers.js +11 -2
- package/src/og/ui/View.js +190 -0
- package/src/og/utils/shared.js +960 -942
- package/src/og/webgl/Framebuffer.js +308 -387
- package/src/og/webgl/Handler.js +90 -30
- package/src/og/webgl/Multisample.js +8 -0
- package/types/Clock.d.ts +7 -2
- package/types/Object3d.d.ts +14 -3
- package/types/camera/Camera.d.ts +18 -17
- package/types/camera/PlanetCamera.d.ts +3 -1
- package/types/control/Atmosphere.d.ts +15 -0
- package/types/control/CompassButton.d.ts +1 -2
- package/types/control/GeoImageDragControl.d.ts +7 -1
- package/types/control/LayerSwitcher.d.ts +5 -6
- package/types/control/Lighting.d.ts +32 -7
- package/types/control/ScaleControl.d.ts +2 -1
- package/types/control/SimpleSkyBackground.d.ts +15 -0
- package/types/control/ZoomControl.d.ts +0 -1
- package/types/control/index.d.ts +4 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/Selection.d.ts +49 -0
- package/types/control/selection/SelectionScene.d.ts +34 -0
- package/types/ellipsoid/Ellipsoid.d.ts +3 -2
- package/types/entity/Entity.d.ts +8 -0
- package/types/entity/GeoObject.d.ts +28 -22
- package/types/entity/GeoObjectHandler.d.ts +16 -56
- package/types/entity/Ray.d.ts +0 -3
- package/types/entity/RayHandler.d.ts +0 -4
- package/types/index.d.ts +9 -6
- package/types/input/input.d.ts +2 -0
- package/types/layer/CanvasTiles.d.ts +1 -0
- package/types/layer/Layer.d.ts +9 -0
- package/types/layer/WMS.d.ts +7 -3
- package/types/math/Plane.d.ts +1 -1
- package/types/math/Vec3.d.ts +19 -16
- package/types/math/Vec4.d.ts +2 -3
- package/types/math.d.ts +20 -20
- package/types/quadTree/index.d.ts +10 -0
- package/types/renderer/Renderer.d.ts +11 -37
- package/types/scene/Planet.d.ts +27 -1
- package/types/scene/RenderNode.d.ts +2 -1
- package/types/segment/Segment.d.ts +1 -1
- package/types/shaders/atmos.d.ts +4 -0
- package/types/shaders/drawnode.d.ts +3 -2
- package/types/shaders/utils.d.ts +1 -0
- package/types/terrain/GlobusTerrain.d.ts +1 -1
- package/types/terrain/MapboxTerrain.d.ts +2 -1
- package/types/ui/Button.d.ts +21 -0
- package/types/ui/Dialog.d.ts +41 -0
- package/types/ui/Slider.d.ts +30 -0
- package/types/ui/ToggleButton.d.ts +10 -0
- package/types/{control → ui}/UIhelpers.d.ts +1 -1
- package/types/ui/View.d.ts +32 -0
- package/types/utils/shared.d.ts +16 -14
- package/types/webgl/Framebuffer.d.ts +2 -5
- package/types/webgl/Handler.d.ts +15 -10
- package/types/webgl/Multisample.d.ts +2 -0
- package/src/og/ajax.js +0 -204
- package/src/og/entity/Object3d.js +0 -504
- package/src/og/utils/quadTreeType.js +0 -11
- package/types/ajax.d.ts +0 -24
- package/types/utils/quadTreeType.d.ts +0 -8
|
@@ -17,11 +17,19 @@ import { Planet } from "../scene/Planet.js";
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
class GeoObject {
|
|
20
|
-
constructor(options) {
|
|
21
|
-
options = options || {};
|
|
20
|
+
constructor(options = {}) {
|
|
22
21
|
|
|
23
|
-
this.
|
|
24
|
-
|
|
22
|
+
this.tag = options.tag || "none";
|
|
23
|
+
|
|
24
|
+
// TODO: not instanced
|
|
25
|
+
this.instanced = true;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Entity instance that holds this geo object.
|
|
29
|
+
* @protected
|
|
30
|
+
* @type {Entity}
|
|
31
|
+
*/
|
|
32
|
+
this._entity = null;
|
|
25
33
|
|
|
26
34
|
/**
|
|
27
35
|
* Geo object center cartesian position.
|
|
@@ -31,17 +39,14 @@ class GeoObject {
|
|
|
31
39
|
this._position = utils.createVector3(options.position);
|
|
32
40
|
|
|
33
41
|
this._positionHigh = new Vec3();
|
|
34
|
-
|
|
35
42
|
this._positionLow = new Vec3();
|
|
36
|
-
|
|
37
43
|
Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
|
|
38
44
|
|
|
39
45
|
this._pitch = options.pitch || 0.0;
|
|
40
46
|
this._yaw = options.yaw || 0.0;
|
|
41
47
|
this._roll = options.roll || 0.0;
|
|
42
48
|
|
|
43
|
-
this.
|
|
44
|
-
this._lonLatAlt = new LonLat(0, 0, 100000);
|
|
49
|
+
this._scale = options.scale || 1.0;
|
|
45
50
|
|
|
46
51
|
/**
|
|
47
52
|
* RGBA color.
|
|
@@ -54,25 +59,51 @@ class GeoObject {
|
|
|
54
59
|
|
|
55
60
|
this._handler = null;
|
|
56
61
|
this._handlerIndex = -1;
|
|
57
|
-
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
60
|
-
|
|
61
|
-
this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
|
|
63
|
+
this._tagData = null;
|
|
64
|
+
this._tagDataIndex = -1;
|
|
65
|
+
|
|
66
|
+
this._object3d = options.object3d;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
getPosition() {
|
|
70
|
+
return this._position;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getPitch() {
|
|
74
|
+
return this._pitch;
|
|
68
75
|
}
|
|
69
76
|
|
|
70
|
-
|
|
71
|
-
return this.
|
|
77
|
+
getYaw() {
|
|
78
|
+
return this._yaw;
|
|
72
79
|
}
|
|
73
80
|
|
|
74
|
-
|
|
75
|
-
return this.
|
|
81
|
+
getRoll() {
|
|
82
|
+
return this._roll;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getDirection() {
|
|
86
|
+
return this._direction;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
get object3d() {
|
|
90
|
+
return this._object3d;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
get vertices() {
|
|
94
|
+
return this._object3d.vertices;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
get normals() {
|
|
98
|
+
return this._object3d.normals;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
get texCoords() {
|
|
102
|
+
return this._object3d.texCoords;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
get indices() {
|
|
106
|
+
return this._object3d.indices;
|
|
76
107
|
}
|
|
77
108
|
|
|
78
109
|
/**
|
|
@@ -86,7 +117,7 @@ class GeoObject {
|
|
|
86
117
|
}
|
|
87
118
|
|
|
88
119
|
/**
|
|
89
|
-
* Sets
|
|
120
|
+
* Sets color.
|
|
90
121
|
* @public
|
|
91
122
|
* @param {number} r - Red.
|
|
92
123
|
* @param {number} g - Green.
|
|
@@ -98,11 +129,11 @@ class GeoObject {
|
|
|
98
129
|
this._color.y = g;
|
|
99
130
|
this._color.z = b;
|
|
100
131
|
a != undefined && (this._color.w = a);
|
|
101
|
-
this._handler && this._handler.setRgbaArr(this.
|
|
132
|
+
this._handler && this._handler.setRgbaArr(this._tagData, this._tagDataIndex, this._color);
|
|
102
133
|
}
|
|
103
134
|
|
|
104
135
|
/**
|
|
105
|
-
* Sets
|
|
136
|
+
* Sets color.
|
|
106
137
|
* @public
|
|
107
138
|
* @param {og.Vec4} color - RGBA vector.
|
|
108
139
|
*/
|
|
@@ -111,7 +142,7 @@ class GeoObject {
|
|
|
111
142
|
this._color.y = color.y;
|
|
112
143
|
this._color.z = color.z;
|
|
113
144
|
color.w != undefined && (this._color.w = color.w);
|
|
114
|
-
this._handler && this._handler.setRgbaArr(this.
|
|
145
|
+
this._handler && this._handler.setRgbaArr(this._tagData, this._tagDataIndex, color);
|
|
115
146
|
}
|
|
116
147
|
|
|
117
148
|
/**
|
|
@@ -121,11 +152,11 @@ class GeoObject {
|
|
|
121
152
|
*/
|
|
122
153
|
setVisibility(visibility) {
|
|
123
154
|
this._visibility = visibility;
|
|
124
|
-
this._handler && this._handler.setVisibility(this.
|
|
155
|
+
this._handler && this._handler.setVisibility(this._tagData, this._tagDataIndex, visibility);
|
|
125
156
|
}
|
|
126
157
|
|
|
127
158
|
/**
|
|
128
|
-
* Returns
|
|
159
|
+
* Returns geo object visibility.
|
|
129
160
|
* @public
|
|
130
161
|
* @returns {boolean}
|
|
131
162
|
*/
|
|
@@ -133,16 +164,8 @@ class GeoObject {
|
|
|
133
164
|
return this._visibility;
|
|
134
165
|
}
|
|
135
166
|
|
|
136
|
-
setLonLat(lon, lat, alt) {
|
|
137
|
-
this._lonLatAlt.lon = lon;
|
|
138
|
-
this._lonLatAlt.lat = lat;
|
|
139
|
-
this._lonLatAlt.height = alt;
|
|
140
|
-
this._handler._planet.ellipsoid.lonLatToCartesianRes(this._lonLatAlt, this._position);
|
|
141
|
-
this.setPosition3v(this._position);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
167
|
/**
|
|
145
|
-
* Sets
|
|
168
|
+
* Sets geo object position.
|
|
146
169
|
* @public
|
|
147
170
|
* @param {number} x - X coordinate.
|
|
148
171
|
* @param {number} y - Y coordinate.
|
|
@@ -154,12 +177,12 @@ class GeoObject {
|
|
|
154
177
|
this._position.z = z;
|
|
155
178
|
Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
|
|
156
179
|
this._handler &&
|
|
157
|
-
|
|
180
|
+
this._handler.setPositionArr(this._tagData, this._tagDataIndex, this._positionHigh, this._positionLow);
|
|
158
181
|
this.updateDirection();
|
|
159
182
|
}
|
|
160
183
|
|
|
161
184
|
/**
|
|
162
|
-
* Sets
|
|
185
|
+
* Sets geo object position.
|
|
163
186
|
* @public
|
|
164
187
|
* @param {og.Vec3} position - Cartesian coordinates.
|
|
165
188
|
*/
|
|
@@ -168,8 +191,7 @@ class GeoObject {
|
|
|
168
191
|
this._position.y = position.y;
|
|
169
192
|
this._position.z = position.z;
|
|
170
193
|
Vec3.doubleToTwoFloats(position, this._positionHigh, this._positionLow);
|
|
171
|
-
this._handler &&
|
|
172
|
-
this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
|
|
194
|
+
this._handler && this._handler.setPositionArr(this._tagData, this._tagDataIndex, this._positionHigh, this._positionLow);
|
|
173
195
|
this.updateDirection();
|
|
174
196
|
}
|
|
175
197
|
|
|
@@ -180,21 +202,21 @@ class GeoObject {
|
|
|
180
202
|
|
|
181
203
|
setPitch(pitch) {
|
|
182
204
|
this._pitch = pitch;
|
|
183
|
-
this._handler && this._handler.setPitchRollArr(this.
|
|
205
|
+
this._handler && this._handler.setPitchRollArr(this._tagData, this._tagDataIndex, pitch, this._roll);
|
|
184
206
|
}
|
|
185
207
|
|
|
186
208
|
setRoll(roll) {
|
|
187
209
|
this._roll = roll;
|
|
188
|
-
this._handler && this._handler.setPitchRollArr(this.
|
|
210
|
+
this._handler && this._handler.setPitchRollArr(this._tagData, this._tagDataIndex, this._pitch, roll);
|
|
189
211
|
}
|
|
190
212
|
|
|
191
213
|
setScale(scale) {
|
|
192
|
-
this.
|
|
193
|
-
this._handler && this._handler.setScaleArr(this.
|
|
214
|
+
this._scale = scale;
|
|
215
|
+
this._handler && this._handler.setScaleArr(this._tagData, this._tagDataIndex, scale);
|
|
194
216
|
}
|
|
195
217
|
|
|
196
218
|
getScale() {
|
|
197
|
-
return this.
|
|
219
|
+
return this._scale;
|
|
198
220
|
}
|
|
199
221
|
|
|
200
222
|
/**
|
|
@@ -212,20 +234,14 @@ class GeoObject {
|
|
|
212
234
|
* @param {og.Vec3} color - Picking color.
|
|
213
235
|
*/
|
|
214
236
|
setPickingColor3v(color) {
|
|
215
|
-
this._handler && this._handler.setPickingColorArr(this.
|
|
237
|
+
this._handler && this._handler.setPickingColorArr(this._tagData, this._tagDataIndex, color);
|
|
216
238
|
}
|
|
217
239
|
|
|
218
240
|
updateDirection() {
|
|
219
|
-
if (this._entity && this._entity.renderNode && this._entity.renderNode.ellipsoid) {
|
|
220
|
-
this._entity.renderNode.ellipsoid.lonLatToCartesianRes(this._lonLatAlt, this._position);
|
|
221
|
-
}
|
|
222
241
|
this._qNorthFrame = Planet.getBearingNorthRotationQuat(this._position);
|
|
223
|
-
|
|
224
|
-
let qq = Quat.yRotation(this._yaw * RADIANS)
|
|
225
|
-
.mul(this._qNorthFrame)
|
|
226
|
-
.conjugate();
|
|
242
|
+
let qq = Quat.yRotation(this._yaw).mul(this._qNorthFrame).conjugate();
|
|
227
243
|
this._direction = qq.mulVec3(new Vec3(0.0, 0.0, -1.0)).normalize();
|
|
228
|
-
this._handler && this._handler.setDirectionArr(this.
|
|
244
|
+
this._handler && this._handler.setDirectionArr(this._tagData, this._tagDataIndex, this._direction);
|
|
229
245
|
}
|
|
230
246
|
}
|
|
231
247
|
|