@openglobus/og 0.11.4 → 0.11.8
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 +3 -2
- package/package.json +12 -14
- package/src/og/Clock.js +6 -10
- package/src/og/Events.js +5 -7
- package/src/og/Extent.js +73 -32
- package/src/og/Globe.js +8 -5
- package/src/og/ImageCanvas.js +18 -15
- package/src/og/LonLat.js +13 -10
- package/src/og/Popup.js +19 -17
- package/src/og/QueueArray.js +3 -4
- package/src/og/Rectangle.js +4 -6
- package/src/og/Stack.js +2 -4
- package/src/og/ajax.js +20 -14
- package/src/og/astro/earth.js +21 -15
- package/src/og/bv/Box.js +2 -3
- package/src/og/bv/Sphere.js +10 -7
- package/src/og/camera/Frustum.js +19 -12
- package/src/og/camera/PlanetCamera.js +9 -5
- package/src/og/control/CompassButton.js +1 -2
- package/src/og/control/Control.js +7 -9
- package/src/og/control/DebugInfo.js +0 -1
- package/src/og/control/KeyboardNavigation.js +9 -9
- package/src/og/control/LayerSwitcher.js +21 -20
- package/src/og/control/Lighting.js +74 -64
- package/src/og/control/MouseNavigation.js +21 -18
- package/src/og/control/MouseWheelZoomControl.js +257 -0
- package/src/og/control/SegmentBoundVisualization.js +5 -6
- package/src/og/control/ShowFps.js +12 -7
- package/src/og/control/SimpleNavigation.js +5 -7
- package/src/og/control/Sun.js +22 -12
- package/src/og/control/ToggleWireframe.js +3 -3
- package/src/og/control/TouchNavigation.js +43 -32
- package/src/og/control/ZoomControl.js +40 -24
- package/src/og/control/index.js +2 -0
- package/src/og/control/visibleExtent/Segment.js +1862 -0
- package/src/og/control/visibleExtent/VisibleExtent.js +80 -0
- package/src/og/control/visibleExtent/drawnode.js +751 -0
- package/src/og/ellipsoid/Ellipsoid.js +149 -57
- package/src/og/ellipsoid/wgs84.js +3 -3
- package/src/og/entity/BaseBillboard.js +72 -30
- package/src/og/entity/Billboard.js +9 -5
- package/src/og/entity/BillboardHandler.js +315 -62
- package/src/og/entity/Entity.js +39 -1
- package/src/og/entity/EntityCollection.js +47 -24
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/GeometryHandler.js +595 -123
- package/src/og/entity/Label.js +62 -30
- package/src/og/entity/LabelHandler.js +40 -242
- package/src/og/entity/LabelWorker.js +218 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +76 -28
- package/src/og/entity/PointCloudHandler.js +5 -5
- package/src/og/entity/Ray.js +49 -16
- package/src/og/entity/Strip.js +72 -43
- package/src/og/entity/StripHandler.js +23 -23
- package/src/og/layer/BaseGeoImage.js +50 -19
- package/src/og/layer/CanvasTiles.js +16 -17
- package/src/og/layer/GeoImage.js +8 -16
- package/src/og/layer/GeoTexture2d.js +2 -10
- package/src/og/layer/GeoVideo.js +2 -10
- package/src/og/layer/KML.js +55 -33
- package/src/og/layer/Layer.js +24 -32
- package/src/og/layer/Material.js +1 -1
- package/src/og/layer/Vector.js +94 -48
- package/src/og/layer/WMS.js +33 -18
- package/src/og/layer/XYZ.js +4 -5
- package/src/og/light/LightSource.js +19 -12
- package/src/og/math/Mat3.js +24 -12
- package/src/og/math/Mat4.js +603 -603
- package/src/og/math/Plane.js +19 -18
- package/src/og/math/Ray.js +17 -12
- package/src/og/math/Vec2.js +24 -14
- package/src/og/math/Vec3.js +60 -30
- package/src/og/math/coder.js +7 -7
- package/src/og/proj/EPSG3857.js +3 -3
- package/src/og/proj/EPSG4326.js +3 -3
- package/src/og/proj/Proj.js +2 -4
- package/src/og/quadTree/Node.js +3 -3
- package/src/og/renderer/Renderer.js +106 -124
- package/src/og/renderer/RendererEvents.js +45 -23
- package/src/og/scene/BaseNode.js +2 -3
- package/src/og/scene/Planet.js +51 -90
- package/src/og/scene/RenderNode.js +15 -8
- package/src/og/segment/Segment.js +60 -156
- package/src/og/segment/Slice.js +45 -0
- package/src/og/shaders/drawnode.js +245 -342
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/pointCloud.js +41 -41
- package/src/og/shaders/shape.js +12 -18
- package/src/og/shaders/skybox.js +36 -36
- package/src/og/shaders/toneMapping.js +1 -0
- package/src/og/shapes/BaseShape.js +108 -36
- package/src/og/shapes/Icosphere.js +25 -10
- package/src/og/shapes/Sphere.js +8 -11
- package/src/og/utils/FontAtlas.js +6 -2
- package/src/og/utils/GeoImageCreator.js +5 -1
- package/src/og/utils/TextureAtlas.js +18 -20
- package/src/og/utils/VectorTileCreator.js +1 -3
- package/src/og/utils/shared.js +2 -2
- package/src/og/webgl/Handler.js +215 -162
- package/src/og/webgl/Multisample.js +44 -16
- package/src/og/webgl/Program.js +78 -33
- package/src/og/webgl/callbacks.js +3 -3
- package/types/Clock.d.ts +0 -94
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -77
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -82
- package/types/ImageCanvas.d.ts +0 -123
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -108
- package/types/Popup.d.ts +0 -42
- package/types/QueueArray.d.ts +0 -19
- package/types/Rectangle.d.ts +0 -80
- package/types/Stack.d.ts +0 -19
- package/types/ajax.d.ts +0 -24
- package/types/arial.d.ts +0 -48
- package/types/astro/astro.d.ts +0 -38
- package/types/astro/earth.d.ts +0 -7
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -30
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -312
- package/types/camera/Frustum.d.ts +0 -133
- package/types/camera/PlanetCamera.d.ts +0 -218
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/CompassButton.d.ts +0 -17
- package/types/control/Control.d.ts +0 -104
- package/types/control/DebugInfo.d.ts +0 -15
- package/types/control/EarthCoordinates.d.ts +0 -47
- package/types/control/EarthNavigation.d.ts +0 -42
- package/types/control/GeoImageDragControl.d.ts +0 -6
- package/types/control/KeyboardNavigation.d.ts +0 -21
- package/types/control/LayerSwitcher.d.ts +0 -21
- package/types/control/Lighting.d.ts +0 -16
- package/types/control/MouseNavigation.d.ts +0 -47
- package/types/control/ScaleControl.d.ts +0 -22
- package/types/control/ShowFps.d.ts +0 -11
- package/types/control/SimpleNavigation.d.ts +0 -25
- package/types/control/Sun.d.ts +0 -50
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -48
- package/types/control/ZoomControl.d.ts +0 -27
- package/types/control/index.d.ts +0 -17
- package/types/ellipsoid/Ellipsoid.d.ts +0 -146
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -6
- package/types/entity/BaseBillboard.d.ts +0 -208
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -78
- package/types/entity/Entity.d.ts +0 -333
- package/types/entity/EntityCollection.d.ts +0 -311
- package/types/entity/Geometry.d.ts +0 -74
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -189
- package/types/entity/LabelHandler.d.ts +0 -29
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -306
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -124
- package/types/entity/RayHandler.d.ts +0 -67
- package/types/entity/ShapeHandler.d.ts +0 -22
- package/types/entity/Strip.d.ts +0 -119
- package/types/entity/StripHandler.d.ts +0 -38
- package/types/entity/index.d.ts +0 -8
- package/types/index.core.d.ts +0 -65
- package/types/index.d.ts +0 -45
- package/types/index.webgl.d.ts +0 -7
- package/types/input/KeyboardHandler.d.ts +0 -10
- package/types/input/MouseHandler.d.ts +0 -5
- package/types/input/TouchHandler.d.ts +0 -5
- package/types/input/input.d.ts +0 -34
- package/types/layer/BaseGeoImage.d.ts +0 -94
- package/types/layer/CanvasTiles.d.ts +0 -68
- package/types/layer/GeoImage.d.ts +0 -52
- package/types/layer/GeoTexture2d.d.ts +0 -8
- package/types/layer/GeoVideo.d.ts +0 -55
- package/types/layer/KML.d.ts +0 -63
- package/types/layer/Layer.d.ts +0 -325
- package/types/layer/Material.d.ts +0 -45
- package/types/layer/Vector.d.ts +0 -208
- package/types/layer/WMS.d.ts +0 -63
- package/types/layer/XYZ.d.ts +0 -120
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -178
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -65
- package/types/math/Mat4.d.ts +0 -176
- package/types/math/Plane.d.ts +0 -18
- package/types/math/Quat.d.ts +0 -379
- package/types/math/Ray.d.ts +0 -82
- package/types/math/Vec2.d.ts +0 -309
- package/types/math/Vec3.d.ts +0 -460
- package/types/math/Vec4.d.ts +0 -162
- package/types/math/coder.d.ts +0 -43
- package/types/math/index.d.ts +0 -11
- package/types/math.d.ts +0 -261
- package/types/mercator.d.ts +0 -92
- package/types/proj/EPSG3857.d.ts +0 -6
- package/types/proj/EPSG4326.d.ts +0 -6
- package/types/proj/Proj.d.ts +0 -42
- package/types/quadTree/EntityCollectionNode.d.ts +0 -34
- package/types/quadTree/Node.d.ts +0 -61
- package/types/quadTree/quadTree.d.ts +0 -40
- package/types/renderer/Renderer.d.ts +0 -298
- package/types/renderer/RendererEvents.d.ts +0 -233
- package/types/res/images.d.ts +0 -3
- package/types/scene/Axes.d.ts +0 -11
- package/types/scene/BaseNode.d.ts +0 -60
- package/types/scene/Planet.d.ts +0 -577
- package/types/scene/RenderNode.d.ts +0 -142
- package/types/scene/SkyBox.d.ts +0 -10
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -279
- package/types/segment/SegmentLonLat.d.ts +0 -16
- package/types/segment/segmentHelper.d.ts +0 -13
- package/types/shaders/billboard.d.ts +0 -3
- package/types/shaders/depth.d.ts +0 -2
- package/types/shaders/drawnode.d.ts +0 -7
- package/types/shaders/label.d.ts +0 -4
- package/types/shaders/pointCloud.d.ts +0 -2
- package/types/shaders/polyline.d.ts +0 -3
- package/types/shaders/ray.d.ts +0 -2
- package/types/shaders/screenFrame.d.ts +0 -2
- package/types/shaders/shape.d.ts +0 -4
- package/types/shaders/skybox.d.ts +0 -2
- package/types/shaders/toneMapping.d.ts +0 -2
- package/types/shapes/BaseShape.d.ts +0 -250
- package/types/shapes/Sphere.d.ts +0 -41
- package/types/terrain/BilTerrain.d.ts +0 -7
- package/types/terrain/EmptyTerrain.d.ts +0 -72
- package/types/terrain/Geoid.d.ts +0 -26
- package/types/terrain/GlobusTerrain.d.ts +0 -116
- package/types/terrain/MapboxTerrain.d.ts +0 -7
- package/types/terrain/index.d.ts +0 -5
- package/types/utils/FontAtlas.d.ts +0 -14
- package/types/utils/GeoImageCreator.d.ts +0 -30
- package/types/utils/ImagesCacheManager.d.ts +0 -10
- package/types/utils/Loader.d.ts +0 -25
- package/types/utils/NormalMapCreator.d.ts +0 -39
- package/types/utils/PlainSegmentWorker.d.ts +0 -10
- package/types/utils/TerrainWorker.d.ts +0 -9
- package/types/utils/TextureAtlas.d.ts +0 -111
- package/types/utils/VectorTileCreator.d.ts +0 -16
- package/types/utils/colorTable.d.ts +0 -143
- package/types/utils/earcut.d.ts +0 -6
- package/types/utils/shared.d.ts +0 -231
- package/types/webgl/Framebuffer.d.ts +0 -135
- package/types/webgl/Handler.d.ts +0 -388
- package/types/webgl/Multisample.d.ts +0 -89
- package/types/webgl/Program.d.ts +0 -155
- package/types/webgl/ProgramController.d.ts +0 -89
- package/types/webgl/callbacks.d.ts +0 -1
- package/types/webgl/index.d.ts +0 -6
- package/types/webgl/types.d.ts +0 -2
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @module og/ellipsoid/Ellipsoid
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as math from
|
|
8
|
-
import { Vec3 } from
|
|
9
|
-
import { LonLat } from
|
|
7
|
+
import * as math from "../math.js";
|
|
8
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
9
|
+
import { LonLat } from "../LonLat.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Class represents a plant ellipsoid.
|
|
@@ -44,8 +44,10 @@ class Ellipsoid {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
static getRelativeBearing(a, b) {
|
|
47
|
-
let a_y = Math.cos(a),
|
|
48
|
-
|
|
47
|
+
let a_y = Math.cos(a),
|
|
48
|
+
a_x = Math.sin(a),
|
|
49
|
+
b_y = Math.cos(b),
|
|
50
|
+
b_x = Math.sin(b);
|
|
49
51
|
let c = a_y * b_x - b_y * a_x,
|
|
50
52
|
d = a_x * b_x + a_y * b_y;
|
|
51
53
|
if (c > 0.0) {
|
|
@@ -75,7 +77,7 @@ class Ellipsoid {
|
|
|
75
77
|
|
|
76
78
|
var l3 = l1 + Math.atan2(By, Math.cos(f1) + Bx);
|
|
77
79
|
|
|
78
|
-
return new LonLat((l3 * math.DEGREES + 540) % 360 - 180, f3 * math.DEGREES);
|
|
80
|
+
return new LonLat(((l3 * math.DEGREES + 540) % 360) - 180, f3 * math.DEGREES);
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
/**
|
|
@@ -86,15 +88,25 @@ class Ellipsoid {
|
|
|
86
88
|
* @returns {LonLat} Intermediate point between points.
|
|
87
89
|
*/
|
|
88
90
|
static getIntermediatePointOnGreatCircle(lonLat1, lonLat2, fraction) {
|
|
89
|
-
var f1 = lonLat1.lat * math.RADIANS,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
var f1 = lonLat1.lat * math.RADIANS,
|
|
92
|
+
l1 = lonLat1.lon * math.RADIANS;
|
|
93
|
+
var f2 = lonLat2.lat * math.RADIANS,
|
|
94
|
+
l2 = lonLat2.lon * math.RADIANS;
|
|
95
|
+
|
|
96
|
+
var sinf1 = Math.sin(f1),
|
|
97
|
+
cosf1 = Math.cos(f1),
|
|
98
|
+
sinl1 = Math.sin(l1),
|
|
99
|
+
cosl1 = Math.cos(l1);
|
|
100
|
+
var sinf2 = Math.sin(f2),
|
|
101
|
+
cosf2 = Math.cos(f2),
|
|
102
|
+
sinl2 = Math.sin(l2),
|
|
103
|
+
cosl2 = Math.cos(l2);
|
|
94
104
|
|
|
95
105
|
var df = f2 - f1,
|
|
96
106
|
dl = l2 - l1;
|
|
97
|
-
var a =
|
|
107
|
+
var a =
|
|
108
|
+
Math.sin(df / 2) * Math.sin(df / 2) +
|
|
109
|
+
Math.cos(f1) * Math.cos(f2) * Math.sin(dl / 2) * Math.sin(dl / 2);
|
|
98
110
|
var d = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
99
111
|
|
|
100
112
|
var A = Math.sin((1 - fraction) * d) / Math.sin(d);
|
|
@@ -107,12 +119,15 @@ class Ellipsoid {
|
|
|
107
119
|
var f3 = Math.atan2(z, Math.sqrt(x * x + y * y));
|
|
108
120
|
var l3 = Math.atan2(y, x);
|
|
109
121
|
|
|
110
|
-
return new LonLat((l3 * math.DEGREES + 540) % 360 - 180, f3 * math.DEGREES);
|
|
122
|
+
return new LonLat(((l3 * math.DEGREES + 540) % 360) - 180, f3 * math.DEGREES);
|
|
111
123
|
}
|
|
112
124
|
|
|
113
125
|
static getRhumbBearing(lonLat1, lonLat2) {
|
|
114
126
|
var dLon = (lonLat2.lon - lonLat1.lon) * math.RADIANS;
|
|
115
|
-
var dPhi = Math.log(
|
|
127
|
+
var dPhi = Math.log(
|
|
128
|
+
Math.tan((lonLat2.lat * math.RADIANS) / 2 + Math.PI / 4) /
|
|
129
|
+
Math.tan((lonLat1.lat * math.RADIANS) / 2 + Math.PI / 4)
|
|
130
|
+
);
|
|
116
131
|
if (Math.abs(dLon) > Math.PI) {
|
|
117
132
|
if (dLon > 0) {
|
|
118
133
|
dLon = (2 * Math.PI - dLon) * -1;
|
|
@@ -124,8 +139,10 @@ class Ellipsoid {
|
|
|
124
139
|
}
|
|
125
140
|
|
|
126
141
|
static getBearing(lonLat1, lonLat2) {
|
|
127
|
-
var f1 = lonLat1.lat * math.RADIANS,
|
|
128
|
-
|
|
142
|
+
var f1 = lonLat1.lat * math.RADIANS,
|
|
143
|
+
l1 = lonLat1.lon * math.RADIANS;
|
|
144
|
+
var f2 = lonLat2.lat * math.RADIANS,
|
|
145
|
+
l2 = lonLat2.lon * math.RADIANS;
|
|
129
146
|
var y = Math.sin(l2 - l1) * Math.cos(f2);
|
|
130
147
|
var x = Math.cos(f1) * Math.sin(f2) - Math.sin(f1) * Math.cos(f2) * Math.cos(l2 - l1);
|
|
131
148
|
return Math.atan2(y, x) * math.DEGREES;
|
|
@@ -142,8 +159,7 @@ class Ellipsoid {
|
|
|
142
159
|
f2 = lonLat2.lat * math.RADIANS;
|
|
143
160
|
var dl = (lonLat2.lon - lonLat1.lon) * math.RADIANS;
|
|
144
161
|
var y = Math.sin(dl) * Math.cos(f2);
|
|
145
|
-
var x = Math.cos(f1) * Math.sin(f2) -
|
|
146
|
-
Math.sin(f1) * Math.cos(f2) * Math.cos(dl);
|
|
162
|
+
var x = Math.cos(f1) * Math.sin(f2) - Math.sin(f1) * Math.cos(f2) * Math.cos(dl);
|
|
147
163
|
var D = Math.atan2(y, x);
|
|
148
164
|
return (D * math.DEGREES + 360) % 360;
|
|
149
165
|
}
|
|
@@ -166,19 +182,30 @@ class Ellipsoid {
|
|
|
166
182
|
var df = f2 - f1,
|
|
167
183
|
dl = l2 - l1;
|
|
168
184
|
|
|
169
|
-
var d12 =
|
|
185
|
+
var d12 =
|
|
186
|
+
2 *
|
|
187
|
+
Math.asin(
|
|
188
|
+
Math.sqrt(
|
|
189
|
+
Math.sin(df / 2) * Math.sin(df / 2) +
|
|
190
|
+
Math.cos(f1) * Math.cos(f2) * Math.sin(dl / 2) * Math.sin(dl / 2)
|
|
191
|
+
)
|
|
192
|
+
);
|
|
170
193
|
if (d12 == 0) return null;
|
|
171
194
|
|
|
172
195
|
// initial/final bearings between points
|
|
173
|
-
var Da = Math.acos(
|
|
196
|
+
var Da = Math.acos(
|
|
197
|
+
(Math.sin(f2) - Math.sin(f1) * Math.cos(d12)) / (Math.sin(d12) * Math.cos(f1))
|
|
198
|
+
);
|
|
174
199
|
if (isNaN(Da)) Da = 0; // protect against rounding
|
|
175
|
-
var Db = Math.acos(
|
|
200
|
+
var Db = Math.acos(
|
|
201
|
+
(Math.sin(f1) - Math.sin(f2) * Math.cos(d12)) / (Math.sin(d12) * Math.cos(f2))
|
|
202
|
+
);
|
|
176
203
|
|
|
177
204
|
var D12 = Math.sin(l2 - l1) > 0 ? Da : 2 * Math.PI - Da;
|
|
178
205
|
var D21 = Math.sin(l2 - l1) > 0 ? 2 * Math.PI - Db : Db;
|
|
179
206
|
|
|
180
|
-
var a1 = (D13 - D12 + Math.PI) % (2 * Math.PI) - Math.PI;
|
|
181
|
-
var a2 = (D21 - D23 + Math.PI) % (2 * Math.PI) - Math.PI;
|
|
207
|
+
var a1 = ((D13 - D12 + Math.PI) % (2 * Math.PI)) - Math.PI;
|
|
208
|
+
var a2 = ((D21 - D23 + Math.PI) % (2 * Math.PI)) - Math.PI;
|
|
182
209
|
|
|
183
210
|
if (Math.sin(a1) == 0 && Math.sin(a2) == 0) return null; // infinite intersections
|
|
184
211
|
if (Math.sin(a1) * Math.sin(a2) < 0) return null; // ambiguous intersection
|
|
@@ -187,13 +214,23 @@ class Ellipsoid {
|
|
|
187
214
|
// a2 = Math.abs(a2);
|
|
188
215
|
// ... Ed Williams takes abs of a1/a2, but seems to break calculation?
|
|
189
216
|
|
|
190
|
-
var a3 = Math.acos(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
var
|
|
217
|
+
var a3 = Math.acos(
|
|
218
|
+
-Math.cos(a1) * Math.cos(a2) + Math.sin(a1) * Math.sin(a2) * Math.cos(d12)
|
|
219
|
+
);
|
|
220
|
+
var d13 = Math.atan2(
|
|
221
|
+
Math.sin(d12) * Math.sin(a1) * Math.sin(a2),
|
|
222
|
+
Math.cos(a2) + Math.cos(a1) * Math.cos(a3)
|
|
223
|
+
);
|
|
224
|
+
var f3 = Math.asin(
|
|
225
|
+
Math.sin(f1) * Math.cos(d13) + Math.cos(f1) * Math.sin(d13) * Math.cos(D13)
|
|
226
|
+
);
|
|
227
|
+
var dl13 = Math.atan2(
|
|
228
|
+
Math.sin(D13) * Math.sin(d13) * Math.cos(f1),
|
|
229
|
+
Math.cos(d13) - Math.sin(f1) * Math.sin(f3)
|
|
230
|
+
);
|
|
194
231
|
var l3 = l1 + dl13;
|
|
195
232
|
|
|
196
|
-
return new LonLat((l3 * math.DEGREES + 540) % 360 - 180, f3 * math.DEGREES);
|
|
233
|
+
return new LonLat(((l3 * math.DEGREES + 540) % 360) - 180, f3 * math.DEGREES);
|
|
197
234
|
}
|
|
198
235
|
|
|
199
236
|
/**
|
|
@@ -244,7 +281,8 @@ class Ellipsoid {
|
|
|
244
281
|
return new Vec3(
|
|
245
282
|
nc * Math.sin(lonrad),
|
|
246
283
|
(N * (1.0 - this._e2) + lonlat.height) * slt,
|
|
247
|
-
nc * Math.cos(lonrad)
|
|
284
|
+
nc * Math.cos(lonrad)
|
|
285
|
+
);
|
|
248
286
|
}
|
|
249
287
|
|
|
250
288
|
/**
|
|
@@ -252,7 +290,7 @@ class Ellipsoid {
|
|
|
252
290
|
* @public
|
|
253
291
|
* @param {LonLat} lonlat - Degrees geodetic coordiantes.
|
|
254
292
|
* @param {Vec3} res - Output result.
|
|
255
|
-
* @returns {Vec3} -
|
|
293
|
+
* @returns {Vec3} -
|
|
256
294
|
*/
|
|
257
295
|
lonLatToCartesianRes(lonlat, res) {
|
|
258
296
|
var latrad = math.RADIANS * lonlat.lat,
|
|
@@ -290,7 +328,8 @@ class Ellipsoid {
|
|
|
290
328
|
return new Vec3(
|
|
291
329
|
nc * Math.sin(lonrad),
|
|
292
330
|
(N * (1 - this._e2) + height) * slt,
|
|
293
|
-
nc * Math.cos(lonrad)
|
|
331
|
+
nc * Math.cos(lonrad)
|
|
332
|
+
);
|
|
294
333
|
}
|
|
295
334
|
|
|
296
335
|
/**
|
|
@@ -300,7 +339,9 @@ class Ellipsoid {
|
|
|
300
339
|
* @returns {LonLat} -
|
|
301
340
|
*/
|
|
302
341
|
cartesianToLonLat(cartesian) {
|
|
303
|
-
var x = cartesian.z,
|
|
342
|
+
var x = cartesian.z,
|
|
343
|
+
y = cartesian.x,
|
|
344
|
+
z = cartesian.y;
|
|
304
345
|
var ecc2 = this._e2;
|
|
305
346
|
var ecc22 = this._e22;
|
|
306
347
|
var r2 = x * x + y * y;
|
|
@@ -309,17 +350,30 @@ class Ellipsoid {
|
|
|
309
350
|
var f = 54.0 * this._b2 * z2;
|
|
310
351
|
var g = r2 + (1.0 - ecc2) * z2 + ecc2 * (this._a2 - this._b2);
|
|
311
352
|
var g2 = g * g;
|
|
312
|
-
var c = ecc22 * f * r2 / (g2 * g);
|
|
313
|
-
var s = Math.pow(
|
|
314
|
-
var p = f / (3.0 * Math.pow(
|
|
353
|
+
var c = (ecc22 * f * r2) / (g2 * g);
|
|
354
|
+
var s = Math.pow(1.0 + c + Math.sqrt(c * (c + 2.0)), 0.33333333333333333);
|
|
355
|
+
var p = f / (3.0 * Math.pow(1.0 + s + 1.0 / s, 2.0) * g2);
|
|
315
356
|
var q = Math.sqrt(1.0 + 2.0 * ecc22 * p);
|
|
316
|
-
var recc2r0 =
|
|
357
|
+
var recc2r0 =
|
|
358
|
+
r -
|
|
359
|
+
ecc2 *
|
|
360
|
+
(-(p * ecc2 * r) / 1 +
|
|
361
|
+
q +
|
|
362
|
+
Math.sqrt(
|
|
363
|
+
0.5 * this._a2 * (1.0 + 1.0 / q) -
|
|
364
|
+
(p * (1.0 - ecc2) * z2) / (q * (1.0 + q)) -
|
|
365
|
+
0.5 * p * r2
|
|
366
|
+
));
|
|
317
367
|
var recc2r02 = recc2r0 * recc2r0;
|
|
318
368
|
var v = Math.sqrt(recc2r02 + (1.0 - ecc2) * z2);
|
|
319
|
-
var z0 = this._b2 * z / (this._a * v);
|
|
369
|
+
var z0 = (this._b2 * z) / (this._a * v);
|
|
320
370
|
var lat = Math.atan((z + this._k2 * z0) / r) * math.DEGREES;
|
|
321
371
|
var lon = Math.atan2(y, x) * math.DEGREES;
|
|
322
|
-
return new LonLat(
|
|
372
|
+
return new LonLat(
|
|
373
|
+
lon,
|
|
374
|
+
lat,
|
|
375
|
+
cartesian.length() - this.geodeticToCartesian(lon, lat).length()
|
|
376
|
+
);
|
|
323
377
|
}
|
|
324
378
|
|
|
325
379
|
/**
|
|
@@ -339,11 +393,22 @@ class Ellipsoid {
|
|
|
339
393
|
|
|
340
394
|
getBearingDestination(lonLat1, bearing, distance) {
|
|
341
395
|
bearing = bearing * math.RADIANS;
|
|
342
|
-
var nlon = (lonLat1.lon + 540) % 360 - 180;
|
|
343
|
-
var f1 = lonLat1.lat * math.RADIANS,
|
|
396
|
+
var nlon = ((lonLat1.lon + 540) % 360) - 180;
|
|
397
|
+
var f1 = lonLat1.lat * math.RADIANS,
|
|
398
|
+
l1 = nlon * math.RADIANS;
|
|
344
399
|
var dR = distance / this._a;
|
|
345
|
-
var f2 = Math.asin(
|
|
346
|
-
|
|
400
|
+
var f2 = Math.asin(
|
|
401
|
+
Math.sin(f1) * Math.cos(dR) + Math.cos(f1) * Math.sin(dR) * Math.cos(bearing)
|
|
402
|
+
);
|
|
403
|
+
return new LonLat(
|
|
404
|
+
(l1 +
|
|
405
|
+
Math.atan2(
|
|
406
|
+
Math.sin(bearing) * Math.sin(dR) * Math.cos(f1),
|
|
407
|
+
Math.cos(dR) - Math.sin(f1) * Math.sin(f2)
|
|
408
|
+
)) *
|
|
409
|
+
math.DEGREES,
|
|
410
|
+
f2 * math.DEGREES
|
|
411
|
+
);
|
|
347
412
|
}
|
|
348
413
|
|
|
349
414
|
/**
|
|
@@ -355,8 +420,12 @@ class Ellipsoid {
|
|
|
355
420
|
getGreatCircleDistance(lonLat1, lonLat2) {
|
|
356
421
|
var dLat = (lonLat2.lat - lonLat1.lat) * math.RADIANS;
|
|
357
422
|
var dLon = (lonLat2.lon - lonLat1.lon) * math.RADIANS;
|
|
358
|
-
var a =
|
|
359
|
-
Math.sin(
|
|
423
|
+
var a =
|
|
424
|
+
Math.sin(dLat / 2.0) * Math.sin(dLat / 2.0) +
|
|
425
|
+
Math.sin(dLon / 2.0) *
|
|
426
|
+
Math.sin(dLon / 2) *
|
|
427
|
+
Math.cos(lonLat1.lat * math.RADIANS) *
|
|
428
|
+
Math.cos(lonLat2.lat * math.RADIANS);
|
|
360
429
|
return this._a * 2.0 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0 - a));
|
|
361
430
|
}
|
|
362
431
|
|
|
@@ -377,28 +446,52 @@ class Ellipsoid {
|
|
|
377
446
|
sinAlpha1 = Math.sin(alpha1),
|
|
378
447
|
cosAlpha1 = Math.cos(alpha1),
|
|
379
448
|
tanU1 = (1 - f) * Math.tan(lat1 * math.RADIANS),
|
|
380
|
-
cosU1 = 1 / Math.sqrt(
|
|
449
|
+
cosU1 = 1 / Math.sqrt(1 + tanU1 * tanU1),
|
|
450
|
+
sinU1 = tanU1 * cosU1,
|
|
381
451
|
sigma1 = Math.atan2(tanU1, cosAlpha1),
|
|
382
452
|
sinAlpha = cosU1 * sinAlpha1,
|
|
383
453
|
cosSqAlpha = 1 - sinAlpha * sinAlpha,
|
|
384
|
-
uSq = cosSqAlpha * (a * a - b * b) / (b * b),
|
|
385
|
-
A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq))),
|
|
386
|
-
B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq))),
|
|
454
|
+
uSq = (cosSqAlpha * (a * a - b * b)) / (b * b),
|
|
455
|
+
A = 1 + (uSq / 16384) * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq))),
|
|
456
|
+
B = (uSq / 1024) * (256 + uSq * (-128 + uSq * (74 - 47 * uSq))),
|
|
387
457
|
sigma = s / (b * A),
|
|
388
458
|
sigmaP = 2 * Math.PI;
|
|
389
459
|
while (Math.abs(sigma - sigmaP) > 1e-12) {
|
|
390
460
|
var cos2SigmaM = Math.cos(2 * sigma1 + sigma),
|
|
391
461
|
sinSigma = Math.sin(sigma),
|
|
392
462
|
cosSigma = Math.cos(sigma),
|
|
393
|
-
deltaSigma =
|
|
463
|
+
deltaSigma =
|
|
464
|
+
B *
|
|
465
|
+
sinSigma *
|
|
466
|
+
(cos2SigmaM +
|
|
467
|
+
(B / 4) *
|
|
468
|
+
(cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) -
|
|
469
|
+
(B / 6) *
|
|
470
|
+
cos2SigmaM *
|
|
471
|
+
(-3 + 4 * sinSigma * sinSigma) *
|
|
472
|
+
(-3 + 4 * cos2SigmaM * cos2SigmaM)));
|
|
394
473
|
sigmaP = sigma;
|
|
395
474
|
sigma = s / (b * A) + deltaSigma;
|
|
396
475
|
}
|
|
397
476
|
var tmp = sinU1 * sinSigma - cosU1 * cosSigma * cosAlpha1,
|
|
398
|
-
lat2 = Math.atan2(
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
477
|
+
lat2 = Math.atan2(
|
|
478
|
+
sinU1 * cosSigma + cosU1 * sinSigma * cosAlpha1,
|
|
479
|
+
(1 - f) * Math.sqrt(sinAlpha * sinAlpha + tmp * tmp)
|
|
480
|
+
),
|
|
481
|
+
lambda = Math.atan2(
|
|
482
|
+
sinSigma * sinAlpha1,
|
|
483
|
+
cosU1 * cosSigma - sinU1 * sinSigma * cosAlpha1
|
|
484
|
+
),
|
|
485
|
+
C = (f / 16) * cosSqAlpha * (4 + f * (4 - 3 * cosSqAlpha)),
|
|
486
|
+
L =
|
|
487
|
+
lambda -
|
|
488
|
+
(1 - C) *
|
|
489
|
+
f *
|
|
490
|
+
sinAlpha *
|
|
491
|
+
(sigma +
|
|
492
|
+
C *
|
|
493
|
+
sinSigma *
|
|
494
|
+
(cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM))),
|
|
402
495
|
revAz = Math.atan2(sinAlpha, -tmp); // final bearing
|
|
403
496
|
return new LonLat(lon1 + L * math.DEGREES, lat2 * math.DEGREES);
|
|
404
497
|
}
|
|
@@ -412,7 +505,6 @@ class Ellipsoid {
|
|
|
412
505
|
* @returns {Vec3} -
|
|
413
506
|
*/
|
|
414
507
|
hitRay(origin, direction) {
|
|
415
|
-
|
|
416
508
|
var q = this._invRadii.mul(origin);
|
|
417
509
|
var w = this._invRadii.mul(direction);
|
|
418
510
|
|
|
@@ -470,7 +562,7 @@ class Ellipsoid {
|
|
|
470
562
|
// qw >= 0.0. Looking outward or tangent.
|
|
471
563
|
return null;
|
|
472
564
|
}
|
|
473
|
-
}
|
|
565
|
+
}
|
|
474
566
|
}
|
|
475
567
|
|
|
476
|
-
export { Ellipsoid };
|
|
568
|
+
export { Ellipsoid };
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @module og/ellipsoid/wgs84
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Ellipsoid } from
|
|
7
|
+
import { Ellipsoid } from "./Ellipsoid.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* WGS84 ellipsoid object.
|
|
11
11
|
* @type {Ellipsoid}
|
|
12
12
|
*/
|
|
13
|
-
export const wgs84 = new Ellipsoid(6378137.
|
|
13
|
+
export const wgs84 = new Ellipsoid(6378137.0, 6356752.3142);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as utils from "../utils/shared.js";
|
|
8
8
|
import { Vec3 } from "../math/Vec3.js";
|
|
9
|
+
import { LOCK_FREE, LOCK_UPDATE } from "./LabelWorker.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Base prototype for billboard and label classes.
|
|
@@ -98,6 +99,15 @@ class BaseBillboard {
|
|
|
98
99
|
* @type {number}
|
|
99
100
|
*/
|
|
100
101
|
this._handlerIndex = -1;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* An indication that the object is ready to draw
|
|
105
|
+
* @protected
|
|
106
|
+
* @type {number}
|
|
107
|
+
*/
|
|
108
|
+
this._isReady = false;
|
|
109
|
+
|
|
110
|
+
this._lockId = LOCK_FREE;
|
|
101
111
|
}
|
|
102
112
|
|
|
103
113
|
static get _staticCounter() {
|
|
@@ -123,8 +133,11 @@ class BaseBillboard {
|
|
|
123
133
|
this._position.y = y;
|
|
124
134
|
this._position.z = z;
|
|
125
135
|
Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
|
|
126
|
-
this._handler
|
|
136
|
+
if (this._isReady && this._handler) {
|
|
127
137
|
this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
|
|
138
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
139
|
+
this._lockId = LOCK_UPDATE;
|
|
140
|
+
}
|
|
128
141
|
}
|
|
129
142
|
|
|
130
143
|
/**
|
|
@@ -137,8 +150,11 @@ class BaseBillboard {
|
|
|
137
150
|
this._position.y = position.y;
|
|
138
151
|
this._position.z = position.z;
|
|
139
152
|
Vec3.doubleToTwoFloats(position, this._positionHigh, this._positionLow);
|
|
140
|
-
this._handler
|
|
153
|
+
if (this._isReady && this._handler) {
|
|
141
154
|
this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
|
|
155
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
156
|
+
this._lockId = LOCK_UPDATE;
|
|
157
|
+
}
|
|
142
158
|
}
|
|
143
159
|
|
|
144
160
|
/**
|
|
@@ -161,7 +177,11 @@ class BaseBillboard {
|
|
|
161
177
|
this._offset.x = x;
|
|
162
178
|
this._offset.y = y;
|
|
163
179
|
z != undefined && (this._offset.z = z);
|
|
164
|
-
this.
|
|
180
|
+
if (this._isReady && this._handler) {
|
|
181
|
+
this._handler.setOffsetArr(this._handlerIndex, this._offset);
|
|
182
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
183
|
+
this._lockId = LOCK_UPDATE;
|
|
184
|
+
}
|
|
165
185
|
}
|
|
166
186
|
|
|
167
187
|
/**
|
|
@@ -170,10 +190,7 @@ class BaseBillboard {
|
|
|
170
190
|
* @param {Vec2} offset - Offset size.
|
|
171
191
|
*/
|
|
172
192
|
setOffset3v(offset) {
|
|
173
|
-
this.
|
|
174
|
-
this._offset.y = offset.y;
|
|
175
|
-
offset.z != undefined && (this._offset.z = offset.z);
|
|
176
|
-
this._handler && this._handler.setOffsetArr(this._handlerIndex, offset);
|
|
193
|
+
this.setOffset(offset.x, offset.y, offset.z);
|
|
177
194
|
}
|
|
178
195
|
|
|
179
196
|
/**
|
|
@@ -191,8 +208,14 @@ class BaseBillboard {
|
|
|
191
208
|
* @param {number} rotation - Screen space rotation in radians.
|
|
192
209
|
*/
|
|
193
210
|
setRotation(rotation) {
|
|
194
|
-
this._rotation
|
|
195
|
-
|
|
211
|
+
if (rotation !== this._rotation) {
|
|
212
|
+
this._rotation = rotation;
|
|
213
|
+
if (this._isReady && this._handler) {
|
|
214
|
+
this._handler.setRotationArr(this._handlerIndex, rotation);
|
|
215
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
216
|
+
this._lockId = LOCK_UPDATE;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
196
219
|
}
|
|
197
220
|
|
|
198
221
|
/**
|
|
@@ -210,8 +233,14 @@ class BaseBillboard {
|
|
|
210
233
|
* @param {number} a - Billboard opacity.
|
|
211
234
|
*/
|
|
212
235
|
setOpacity(a) {
|
|
213
|
-
this._color.w
|
|
214
|
-
|
|
236
|
+
if (a !== this._color.w) {
|
|
237
|
+
a != undefined && (this._color.w = a);
|
|
238
|
+
if (this._isReady && this._handler) {
|
|
239
|
+
this._handler.setRgbaArr(this._handlerIndex, this._color);
|
|
240
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
241
|
+
this._lockId = LOCK_UPDATE;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
215
244
|
}
|
|
216
245
|
|
|
217
246
|
/**
|
|
@@ -223,11 +252,17 @@ class BaseBillboard {
|
|
|
223
252
|
* @param {number} a - Alpha.
|
|
224
253
|
*/
|
|
225
254
|
setColor(r, g, b, a) {
|
|
226
|
-
this._color.x
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
255
|
+
if (a !== this._color.w || r !== this._color.x || g !== this._color.y || this._color.z !== b) {
|
|
256
|
+
this._color.x = r;
|
|
257
|
+
this._color.y = g;
|
|
258
|
+
this._color.z = b;
|
|
259
|
+
a != undefined && (this._color.w = a);
|
|
260
|
+
if (this._isReady && this._handler) {
|
|
261
|
+
this._handler.setRgbaArr(this._handlerIndex, this._color);
|
|
262
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
263
|
+
this._lockId = LOCK_UPDATE;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
231
266
|
}
|
|
232
267
|
|
|
233
268
|
/**
|
|
@@ -236,11 +271,7 @@ class BaseBillboard {
|
|
|
236
271
|
* @param {Vec4} color - RGBA vector.
|
|
237
272
|
*/
|
|
238
273
|
setColor4v(color) {
|
|
239
|
-
this.
|
|
240
|
-
this._color.y = color.y;
|
|
241
|
-
this._color.z = color.z;
|
|
242
|
-
color.w != undefined && (this._color.w = color.w);
|
|
243
|
-
this._handler && this._handler.setRgbaArr(this._handlerIndex, color);
|
|
274
|
+
this.setColor(color.x, color.y, color.z, color.w);
|
|
244
275
|
}
|
|
245
276
|
|
|
246
277
|
/**
|
|
@@ -267,8 +298,14 @@ class BaseBillboard {
|
|
|
267
298
|
* @param {boolean} visibility - Visibility flag.
|
|
268
299
|
*/
|
|
269
300
|
setVisibility(visibility) {
|
|
270
|
-
this._visibility
|
|
271
|
-
|
|
301
|
+
if (visibility !== this._visibility) {
|
|
302
|
+
this._visibility = visibility;
|
|
303
|
+
if (this._isReady && this._handler) {
|
|
304
|
+
this._handler.setVisibility(this._handlerIndex, visibility);
|
|
305
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
306
|
+
this._lockId = LOCK_UPDATE;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
272
309
|
}
|
|
273
310
|
|
|
274
311
|
/**
|
|
@@ -291,7 +328,11 @@ class BaseBillboard {
|
|
|
291
328
|
this._alignedAxis.x = x;
|
|
292
329
|
this._alignedAxis.y = y;
|
|
293
330
|
this._alignedAxis.z = z;
|
|
294
|
-
this.
|
|
331
|
+
if (this._isReady && this._handler) {
|
|
332
|
+
this._handler.setAlignedAxisArr(this._handlerIndex, this._alignedAxis);
|
|
333
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
334
|
+
this._lockId = LOCK_UPDATE;
|
|
335
|
+
}
|
|
295
336
|
}
|
|
296
337
|
|
|
297
338
|
/**
|
|
@@ -300,10 +341,7 @@ class BaseBillboard {
|
|
|
300
341
|
* @param {math.Vecto3} alignedAxis - Vector to align.
|
|
301
342
|
*/
|
|
302
343
|
setAlignedAxis3v(alignedAxis) {
|
|
303
|
-
this.
|
|
304
|
-
this._alignedAxis.y = alignedAxis.y;
|
|
305
|
-
this._alignedAxis.z = alignedAxis.z;
|
|
306
|
-
this._handler && this._handler.setAlignedAxisArr(this._handlerIndex, alignedAxis);
|
|
344
|
+
this.setAlignedAxis(alignedAxis.x, alignedAxis.y, alignedAxis.z);
|
|
307
345
|
}
|
|
308
346
|
|
|
309
347
|
/**
|
|
@@ -330,8 +368,12 @@ class BaseBillboard {
|
|
|
330
368
|
* @param {Vec3} color - Picking color.
|
|
331
369
|
*/
|
|
332
370
|
setPickingColor3v(color) {
|
|
333
|
-
this.
|
|
371
|
+
if (this._isReady && this._handler) {
|
|
372
|
+
this._handler.setPickingColorArr(this._handlerIndex, color);
|
|
373
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
374
|
+
this._lockId = LOCK_UPDATE;
|
|
375
|
+
}
|
|
334
376
|
}
|
|
335
377
|
}
|
|
336
378
|
|
|
337
|
-
export { BaseBillboard };
|
|
379
|
+
export { BaseBillboard };
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @module og/entity/Billboard
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { BaseBillboard } from
|
|
7
|
+
import { BaseBillboard } from "./BaseBillboard.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents basic quad billboard image.
|
|
@@ -76,7 +76,10 @@ class Billboard extends BaseBillboard {
|
|
|
76
76
|
ta.loadImage(src, function (img) {
|
|
77
77
|
if (ta.nodes[img.__nodeIndex]) {
|
|
78
78
|
that._image = img;
|
|
79
|
-
bh.setTexCoordArr(
|
|
79
|
+
bh.setTexCoordArr(
|
|
80
|
+
that._handlerIndex,
|
|
81
|
+
ta.nodes[that._image.__nodeIndex].texCoords
|
|
82
|
+
);
|
|
80
83
|
} else {
|
|
81
84
|
ta.addImage(img);
|
|
82
85
|
ta.createTexture();
|
|
@@ -106,7 +109,8 @@ class Billboard extends BaseBillboard {
|
|
|
106
109
|
setSize(width, height) {
|
|
107
110
|
this._width = width;
|
|
108
111
|
this._height = height;
|
|
109
|
-
this._handler &&
|
|
112
|
+
this._handler &&
|
|
113
|
+
this._handler.setSizeArr(this._handlerIndex, width * this._scale, height * this._scale);
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
/**
|
|
@@ -158,4 +162,4 @@ class Billboard extends BaseBillboard {
|
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
164
|
|
|
161
|
-
export { Billboard };
|
|
165
|
+
export { Billboard };
|