@openglobus/og 0.10.4 → 0.11.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 +1 -1
- package/package.json +11 -9
- package/src/og/Extent.js +274 -273
- package/src/og/Globe.js +11 -3
- package/src/og/LonLat.js +152 -146
- package/src/og/Popup.js +2 -1
- package/src/og/camera/PlanetCamera.js +112 -38
- package/src/og/control/EarthNavigation.js +259 -0
- package/src/og/control/MouseNavigation.js +68 -40
- package/src/og/entity/EntityCollection.js +1 -1
- package/src/og/entity/LabelHandler.js +366 -74
- package/src/og/entity/Polyline.js +3 -2
- package/src/og/layer/CanvasTiles.js +32 -30
- package/src/og/layer/KML.js +159 -0
- package/src/og/layer/Vector.js +5 -0
- package/src/og/layer/index.js +2 -1
- package/src/og/math/Vec2.js +448 -448
- package/src/og/math/Vec3.js +759 -757
- package/src/og/math/Vec4.js +216 -215
- package/src/og/quadTree/Node.js +67 -13
- package/src/og/renderer/RendererEvents.js +21 -16
- package/src/og/scene/Planet.js +25 -10
- package/src/og/segment/Segment.js +3 -3
- package/src/og/segment/SegmentLonLat.js +7 -0
- package/src/og/terrain/GlobusTerrain.js +4 -0
- package/src/og/utils/FontAtlas.js +1 -0
- package/src/og/utils/GeoImageCreator.js +123 -121
- package/src/og/utils/Loader.js +81 -80
- package/src/og/utils/NormalMapCreator.js +320 -318
- package/src/og/utils/VectorTileCreator.js +251 -250
- package/src/og/webgl/Framebuffer.js +265 -264
- package/src/og/webgl/Handler.js +1022 -1001
- package/src/og/webgl/Multisample.js +169 -168
- package/src/og/webgl/ProgramController.js +113 -112
- package/types/Clock.d.ts +90 -0
- package/types/Deferred.d.ts +6 -0
- package/types/Events.d.ts +73 -0
- package/types/Extent.d.ts +162 -0
- package/types/Globe.d.ts +80 -0
- package/types/ImageCanvas.d.ts +121 -0
- package/types/Lock.d.ts +12 -0
- package/types/LonLat.d.ts +108 -0
- package/types/Popup.d.ts +38 -0
- package/types/QueueArray.d.ts +15 -0
- package/types/Rectangle.d.ts +74 -0
- package/types/Stack.d.ts +15 -0
- package/types/ajax.d.ts +24 -0
- package/types/arial.d.ts +48 -0
- package/types/astro/astro.d.ts +38 -0
- package/types/astro/earth.d.ts +6 -0
- package/types/astro/jd.d.ts +254 -0
- package/types/bv/Box.d.ts +25 -0
- package/types/bv/Sphere.d.ts +32 -0
- package/types/bv/index.d.ts +3 -0
- package/types/camera/Camera.d.ts +303 -0
- package/types/camera/Frustum.d.ts +129 -0
- package/types/camera/PlanetCamera.d.ts +222 -0
- package/types/camera/index.d.ts +3 -0
- package/types/cons.d.ts +40 -0
- package/types/control/CompassButton.d.ts +17 -0
- package/types/control/Control.d.ts +101 -0
- package/types/control/DebugInfo.d.ts +16 -0
- package/types/control/EarthCoordinates.d.ts +47 -0
- package/types/control/GeoImageDragControl.d.ts +6 -0
- package/types/control/KeyboardNavigation.d.ts +22 -0
- package/types/control/LayerSwitcher.d.ts +23 -0
- package/types/control/Lighting.d.ts +16 -0
- package/types/control/ScaleControl.d.ts +22 -0
- package/types/control/ShowFps.d.ts +12 -0
- package/types/control/SimpleNavigation.d.ts +28 -0
- package/types/control/Sun.d.ts +52 -0
- package/types/control/ToggleWireframe.d.ts +12 -0
- package/types/control/ZoomControl.d.ts +28 -0
- package/types/control/index.d.ts +15 -0
- package/types/ellipsoid/Ellipsoid.d.ts +142 -0
- package/types/ellipsoid/index.d.ts +3 -0
- package/types/ellipsoid/wgs84.d.ts +5 -0
- package/types/entity/BaseBillboard.d.ts +208 -0
- package/types/entity/Billboard.d.ts +94 -0
- package/types/entity/BillboardHandler.d.ts +74 -0
- package/types/entity/Entity.d.ts +330 -0
- package/types/entity/EntityCollection.d.ts +303 -0
- package/types/entity/Geometry.d.ts +72 -0
- package/types/entity/GeometryHandler.d.ts +76 -0
- package/types/entity/Label.d.ts +194 -0
- package/types/entity/LabelHandler.d.ts +24 -0
- package/types/entity/PointCloud.d.ts +174 -0
- package/types/entity/PointCloudHandler.d.ts +38 -0
- package/types/entity/Polyline.d.ts +303 -0
- package/types/entity/PolylineHandler.d.ts +18 -0
- package/types/entity/Ray.d.ts +123 -0
- package/types/entity/RayHandler.d.ts +67 -0
- package/types/entity/ShapeHandler.d.ts +22 -0
- package/types/entity/Strip.d.ts +118 -0
- package/types/entity/StripHandler.d.ts +38 -0
- package/types/entity/index.d.ts +8 -0
- package/types/index.core.d.ts +65 -0
- package/types/index.d.ts +45 -0
- package/types/index.webgl.d.ts +7 -0
- package/types/inherits.d.ts +4 -0
- package/types/input/input.d.ts +34 -0
- package/types/layer/BaseGeoImage.d.ts +106 -0
- package/types/layer/CanvasTiles.d.ts +75 -0
- package/types/layer/GeoImage.d.ts +65 -0
- package/types/layer/GeoTexture2d.d.ts +8 -0
- package/types/layer/GeoVideo.d.ts +80 -0
- package/types/layer/KML.d.ts +58 -0
- package/types/layer/WMS.d.ts +66 -0
- package/types/layer/XYZ.d.ts +126 -0
- package/types/layer/index.d.ts +10 -0
- package/types/light/LightSource.d.ts +177 -0
- package/types/math/Mat3.d.ts +53 -0
- package/types/math/Mat4.d.ts +157 -0
- package/types/math/Plane.d.ts +17 -0
- package/types/math/Vec2.d.ts +308 -0
- package/types/math/Vec3.d.ts +459 -0
- package/types/math/Vec4.d.ts +161 -0
- package/types/math/coder.d.ts +42 -0
- package/types/math/index.d.ts +11 -0
- package/types/math.d.ts +261 -0
- package/types/mercator.d.ts +92 -0
- package/types/proj/EPSG3857.d.ts +5 -0
- package/types/proj/EPSG4326.d.ts +5 -0
- package/types/quadTree/quadTree.d.ts +40 -0
- package/types/renderer/RendererEvents.d.ts +230 -0
- package/types/res/images.d.ts +3 -0
- package/types/scene/Axes.d.ts +11 -0
- package/types/scene/BaseNode.d.ts +60 -0
- package/types/scene/Planet.d.ts +572 -0
- package/types/scene/RenderNode.d.ts +143 -0
- package/types/scene/SkyBox.d.ts +10 -0
- package/types/scene/index.d.ts +4 -0
- package/types/segment/segmentHelper.d.ts +13 -0
- package/types/shaders/billboard.d.ts +3 -0
- package/types/shaders/depth.d.ts +2 -0
- package/types/shaders/drawnode.d.ts +7 -0
- package/types/shaders/label.d.ts +4 -0
- package/types/shaders/pointCloud.d.ts +2 -0
- package/types/shaders/polyline.d.ts +3 -0
- package/types/shaders/ray.d.ts +2 -0
- package/types/shaders/screenFrame.d.ts +2 -0
- package/types/shaders/shape.d.ts +4 -0
- package/types/shaders/skybox.d.ts +2 -0
- package/types/shaders/toneMapping.d.ts +2 -0
- package/types/shapes/BaseShape.d.ts +247 -0
- package/types/shapes/Sphere.d.ts +41 -0
- package/types/terrain/BilTerrain.d.ts +8 -0
- package/types/terrain/EmptyTerrain.d.ts +72 -0
- package/types/terrain/Geoid.d.ts +26 -0
- package/types/terrain/GlobusTerrain.d.ts +153 -0
- package/types/terrain/MapboxTerrain.d.ts +8 -0
- package/types/terrain/index.d.ts +5 -0
- package/types/utils/FontAtlas.d.ts +14 -0
- package/types/utils/GeoImageCreator.d.ts +29 -0
- package/types/utils/ImagesCacheManager.d.ts +10 -0
- package/types/utils/Loader.d.ts +25 -0
- package/types/utils/NormalMapCreator.d.ts +39 -0
- package/types/utils/PlainSegmentWorker.d.ts +10 -0
- package/types/utils/TerrainWorker.d.ts +9 -0
- package/types/utils/TextureAtlas.d.ts +111 -0
- package/types/utils/VectorTileCreator.d.ts +16 -0
- package/types/utils/colorTable.d.ts +143 -0
- package/types/utils/earcut.d.ts +6 -0
- package/types/utils/shared.d.ts +230 -0
- package/types/webgl/Framebuffer.d.ts +135 -0
- package/types/webgl/Handler.d.ts +372 -0
- package/types/webgl/Multisample.d.ts +89 -0
- package/types/webgl/Program.d.ts +155 -0
- package/types/webgl/ProgramController.d.ts +84 -0
- package/types/webgl/callbacks.d.ts +1 -0
- package/types/webgl/index.d.ts +6 -0
- package/types/webgl/types.d.ts +2 -0
package/src/og/math/Vec4.js
CHANGED
|
@@ -14,251 +14,252 @@ import { Vec3 } from './Vec3.js';
|
|
|
14
14
|
* @param {number} [z] - Third value.
|
|
15
15
|
* @param {number} [w] - Fourth value.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
export class Vec4 {
|
|
18
|
+
|
|
19
|
+
constructor(x, y, z, w) {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
* @type {number}
|
|
24
|
+
*/
|
|
25
|
+
this.x = x || 0.0;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
* @type {number}
|
|
30
|
+
*/
|
|
31
|
+
this.y = y || 0.0;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
* @type {number}
|
|
36
|
+
*/
|
|
37
|
+
this.z = z || 0.0;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @public
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
43
|
+
this.w = w || 0.0;
|
|
44
|
+
};
|
|
18
45
|
|
|
19
46
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
47
|
+
* Identity vector [0,0,0,1].
|
|
48
|
+
* @const
|
|
49
|
+
* @type {og.math.Vec4}
|
|
22
50
|
*/
|
|
23
|
-
|
|
51
|
+
static get identity() { return new Vec4(0, 0, 0, 1) };
|
|
24
52
|
|
|
25
53
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @
|
|
54
|
+
* Creates 4d vector from array.
|
|
55
|
+
* @function
|
|
56
|
+
* @param {Array.<number,number,number,number>}
|
|
57
|
+
* @returns {og.math.Vec4}
|
|
28
58
|
*/
|
|
29
|
-
|
|
59
|
+
static fromVec(arr) {
|
|
60
|
+
return new Vec4(arr[0], arr[1], arr[2], arr[3]);
|
|
61
|
+
};
|
|
30
62
|
|
|
31
63
|
/**
|
|
64
|
+
* Converts to 3d vector, without fourth value.
|
|
32
65
|
* @public
|
|
33
|
-
* @
|
|
66
|
+
* @returns {og.Vec3}
|
|
34
67
|
*/
|
|
35
|
-
|
|
68
|
+
toVec3() {
|
|
69
|
+
return new Vec3(this.x, this.y, this.z);
|
|
70
|
+
};
|
|
36
71
|
|
|
37
72
|
/**
|
|
73
|
+
* Returns clone vector.
|
|
38
74
|
* @public
|
|
39
|
-
* @
|
|
75
|
+
* @returns {og.math.Vec4}
|
|
40
76
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Identity vector [0,0,0,1].
|
|
46
|
-
* @const
|
|
47
|
-
* @type {og.math.Vec4}
|
|
48
|
-
*/
|
|
49
|
-
Vec4.identity = new Vec4(0, 0, 0, 1);
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Vector 4d object creator.
|
|
53
|
-
* @function
|
|
54
|
-
* @param {number} [x] - First cvalue.
|
|
55
|
-
* @param {number} [y] - Second value.
|
|
56
|
-
* @param {number} [z] - Third value.
|
|
57
|
-
* @param {number} [w] - Fourth value.
|
|
58
|
-
* @returns {og.math.Vec4}
|
|
59
|
-
*/
|
|
60
|
-
export function vec4(x, y, z, w) {
|
|
61
|
-
return new og.math.Vec4(x, y, z, w);
|
|
62
|
-
};
|
|
77
|
+
clone(v) {
|
|
78
|
+
return new Vec4(this.x, this.y, this.z, this.w);
|
|
79
|
+
};
|
|
63
80
|
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
81
|
+
/**
|
|
82
|
+
* Compares with vector. Returns true if it equals another.
|
|
83
|
+
* @public
|
|
84
|
+
* @param {og.math.Vec4} p - Vector to compare.
|
|
85
|
+
* @returns {boolean}
|
|
86
|
+
*/
|
|
87
|
+
equal(v) {
|
|
88
|
+
return this.x === v.x && this.y === v.y && this.z === v.z && this.w === v.w;
|
|
89
|
+
};
|
|
73
90
|
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Copy input vector's values.
|
|
93
|
+
* @param {og.math.Vec4} v - Vector to copy.
|
|
94
|
+
* @returns {og.math.Vec4}
|
|
95
|
+
*/
|
|
96
|
+
copy(v) {
|
|
97
|
+
this.x = v.x;
|
|
98
|
+
this.y = v.y;
|
|
99
|
+
this.z = v.z;
|
|
100
|
+
this.w = v.w;
|
|
101
|
+
return this;
|
|
102
|
+
};
|
|
82
103
|
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Converts vector to a number array.
|
|
106
|
+
* @public
|
|
107
|
+
* @returns {Array.<number,number,number,number>}
|
|
108
|
+
* @deprecated
|
|
109
|
+
*/
|
|
110
|
+
toVec() {
|
|
111
|
+
return [this.x, this.y, this.z, this.w];
|
|
112
|
+
};
|
|
91
113
|
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
};
|
|
114
|
+
/**
|
|
115
|
+
* Converts vector to a number array.
|
|
116
|
+
* @public
|
|
117
|
+
* @returns {Array.<number,number,number,number>}
|
|
118
|
+
*/
|
|
119
|
+
toArray() {
|
|
120
|
+
return [this.x, this.y, this.z, this.w];
|
|
121
|
+
};
|
|
101
122
|
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Sets vector's values.
|
|
125
|
+
* @public
|
|
126
|
+
* @param {number} x - Value X.
|
|
127
|
+
* @param {number} y - Value Y.
|
|
128
|
+
* @param {number} z - Value Z.
|
|
129
|
+
* @param {number} w - Value W.
|
|
130
|
+
* @returns {og.math.Vec4}
|
|
131
|
+
*/
|
|
132
|
+
set(x, y, z, w) {
|
|
133
|
+
this.x = x;
|
|
134
|
+
this.y = y;
|
|
135
|
+
this.z = z;
|
|
136
|
+
this.w = w;
|
|
137
|
+
return this;
|
|
138
|
+
};
|
|
114
139
|
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Adds vector to the current.
|
|
142
|
+
* @public
|
|
143
|
+
* @param {og.math.Vec4}
|
|
144
|
+
* @returns {og.math.Vec4}
|
|
145
|
+
*/
|
|
146
|
+
addA(v) {
|
|
147
|
+
this.x += v.x;
|
|
148
|
+
this.y += v.y;
|
|
149
|
+
this.z += v.z;
|
|
150
|
+
this.w += v.w;
|
|
151
|
+
return this;
|
|
152
|
+
};
|
|
124
153
|
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Subtract vector from the current.
|
|
156
|
+
* @public
|
|
157
|
+
* @param {og.math.Vec4} v - Subtract vector.
|
|
158
|
+
* @returns {og.math.Vec4}
|
|
159
|
+
*/
|
|
160
|
+
subA(v) {
|
|
161
|
+
this.x -= v.x;
|
|
162
|
+
this.y -= v.y;
|
|
163
|
+
this.z -= v.z;
|
|
164
|
+
this.w -= v.w;
|
|
165
|
+
return this;
|
|
166
|
+
};
|
|
133
167
|
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.w = w;
|
|
148
|
-
return this;
|
|
149
|
-
};
|
|
168
|
+
/**
|
|
169
|
+
* Scale current vector.
|
|
170
|
+
* @public
|
|
171
|
+
* @param {number} scale - Scale value.
|
|
172
|
+
* @returns {og.math.Vec4}
|
|
173
|
+
*/
|
|
174
|
+
scale(scale) {
|
|
175
|
+
this.x *= scale;
|
|
176
|
+
this.y *= scale;
|
|
177
|
+
this.z *= scale;
|
|
178
|
+
this.w *= scale;
|
|
179
|
+
return this;
|
|
180
|
+
};
|
|
150
181
|
|
|
151
|
-
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
};
|
|
182
|
+
/**
|
|
183
|
+
* Makes vector affinity. Thereby fourh component becomes to 1.0.
|
|
184
|
+
* @public
|
|
185
|
+
* @returns {og.math.Vec4}
|
|
186
|
+
*/
|
|
187
|
+
affinity() {
|
|
188
|
+
var iw = 1 / this.w;
|
|
189
|
+
this.x *= iw;
|
|
190
|
+
this.y *= iw;
|
|
191
|
+
this.z *= iw;
|
|
192
|
+
this.w = 1.0;
|
|
193
|
+
return this;
|
|
194
|
+
};
|
|
164
195
|
|
|
165
|
-
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this.z -= v.z;
|
|
175
|
-
this.w -= v.w;
|
|
176
|
-
return this;
|
|
177
|
-
};
|
|
196
|
+
/**
|
|
197
|
+
* Scale current vector to another instance.
|
|
198
|
+
* @public
|
|
199
|
+
* @param {number} scale - Scale value.
|
|
200
|
+
* @returns {og.Vec3}
|
|
201
|
+
*/
|
|
202
|
+
scaleTo(scale) {
|
|
203
|
+
return new Vec4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);
|
|
204
|
+
};
|
|
178
205
|
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
};
|
|
206
|
+
/**
|
|
207
|
+
* Vector's edge function that returns vector where each component is 0.0 if it's smaller then edge and otherwise 1.0.
|
|
208
|
+
* @public
|
|
209
|
+
* @returns {og.math.Vec4}
|
|
210
|
+
*/
|
|
211
|
+
getStep(edge) {
|
|
212
|
+
return new Vec4(
|
|
213
|
+
this.x < edge ? 0.0 : 1.0,
|
|
214
|
+
this.y < edge ? 0.0 : 1.0,
|
|
215
|
+
this.z < edge ? 0.0 : 1.0,
|
|
216
|
+
this.w < edge ? 0.0 : 1.0
|
|
217
|
+
);
|
|
218
|
+
};
|
|
192
219
|
|
|
193
|
-
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
};
|
|
220
|
+
/**
|
|
221
|
+
* The vector fract function returns the vector of fractional parts of each value, i.e. x minus floor(x).
|
|
222
|
+
* @public
|
|
223
|
+
* @returns {og.math.Vec4}
|
|
224
|
+
*/
|
|
225
|
+
getFrac(v) {
|
|
226
|
+
return new Vec4(
|
|
227
|
+
og.math.frac(v.x),
|
|
228
|
+
og.math.frac(v.y),
|
|
229
|
+
og.math.frac(v.z),
|
|
230
|
+
og.math.frac(v.w)
|
|
231
|
+
);
|
|
232
|
+
};
|
|
206
233
|
|
|
207
|
-
/**
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
};
|
|
234
|
+
/**
|
|
235
|
+
* Gets vectors dot production.
|
|
236
|
+
* @public
|
|
237
|
+
* @param {og.math.Vec4} v - Another vector.
|
|
238
|
+
* @returns {number} - Dot product.
|
|
239
|
+
*/
|
|
240
|
+
dot(v) {
|
|
241
|
+
return v.x * this.x + v.y * this.y + v.z * this.z + v.w * this.w;
|
|
242
|
+
};
|
|
216
243
|
|
|
217
|
-
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
this.z < edge ? 0.0 : 1.0,
|
|
227
|
-
this.w < edge ? 0.0 : 1.0
|
|
228
|
-
);
|
|
229
|
-
};
|
|
244
|
+
/**
|
|
245
|
+
* Returns true if vector's values are zero.
|
|
246
|
+
* @public
|
|
247
|
+
* @returns {boolean} -
|
|
248
|
+
*/
|
|
249
|
+
isZero() {
|
|
250
|
+
return !(this.x || this.y || this.z || this.w);
|
|
251
|
+
};
|
|
252
|
+
}
|
|
230
253
|
|
|
231
254
|
/**
|
|
232
|
-
*
|
|
233
|
-
* @
|
|
255
|
+
* Vector 4d object creator.
|
|
256
|
+
* @function
|
|
257
|
+
* @param {number} [x] - First cvalue.
|
|
258
|
+
* @param {number} [y] - Second value.
|
|
259
|
+
* @param {number} [z] - Third value.
|
|
260
|
+
* @param {number} [w] - Fourth value.
|
|
234
261
|
* @returns {og.math.Vec4}
|
|
235
262
|
*/
|
|
236
|
-
|
|
237
|
-
return new Vec4(
|
|
238
|
-
og.math.frac(v.x),
|
|
239
|
-
og.math.frac(v.y),
|
|
240
|
-
og.math.frac(v.z),
|
|
241
|
-
og.math.frac(v.w)
|
|
242
|
-
);
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Gets vectors dot production.
|
|
247
|
-
* @public
|
|
248
|
-
* @param {og.math.Vec4} v - Another vector.
|
|
249
|
-
* @returns {number} - Dot product.
|
|
250
|
-
*/
|
|
251
|
-
Vec4.prototype.dot = function (v) {
|
|
252
|
-
return v.x * this.x + v.y * this.y + v.z * this.z + v.w * this.w;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Returns true if vector's values are zero.
|
|
257
|
-
* @public
|
|
258
|
-
* @returns {boolean} -
|
|
259
|
-
*/
|
|
260
|
-
Vec4.prototype.isZero = function () {
|
|
261
|
-
return !(this.x || this.y || this.z || this.w);
|
|
263
|
+
export function vec4(x, y, z, w) {
|
|
264
|
+
return new og.math.Vec4(x, y, z, w);
|
|
262
265
|
};
|
|
263
|
-
|
|
264
|
-
export { Vec4 };
|
package/src/og/quadTree/Node.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
|
|
33
33
|
import { MAX_NORMAL_ZOOM } from "../segment/Segment.js";
|
|
34
34
|
|
|
35
|
-
const VISIBLE_HEIGHT =
|
|
35
|
+
const VISIBLE_HEIGHT = 1400000.0;
|
|
36
36
|
|
|
37
37
|
let _tempHigh = new Vec3(),
|
|
38
38
|
_tempLow = new Vec3();
|
|
@@ -331,7 +331,7 @@ Node.prototype.prepareForRendering = function (
|
|
|
331
331
|
} else {
|
|
332
332
|
if (seg.tileZoom < 2) {
|
|
333
333
|
this.renderNode(inFrustum, !inFrustum, terrainReadySegment, stopLoading);
|
|
334
|
-
} else if (seg.tileZoom
|
|
334
|
+
} else if (seg.tileZoom > MAX_NORMAL_ZOOM) {
|
|
335
335
|
this.renderNode(inFrustum, !inFrustum, terrainReadySegment, stopLoading);
|
|
336
336
|
} else if (
|
|
337
337
|
seg._swNorm.dot(cam._n) > 0.0 ||
|
|
@@ -477,26 +477,80 @@ Node.prototype.getCommonSide = function (node) {
|
|
|
477
477
|
b_sw_lon = b_sw.lon,
|
|
478
478
|
b_sw_lat = b_sw.lat;
|
|
479
479
|
|
|
480
|
+
if (as._tileGroup === bs._tileGroup) {
|
|
481
|
+
if (
|
|
482
|
+
a_ne_lon === b_sw_lon &&
|
|
483
|
+
((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
|
|
484
|
+
(a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
|
|
485
|
+
) {
|
|
486
|
+
return E;
|
|
487
|
+
} else if (
|
|
488
|
+
a_sw_lon === b_ne_lon &&
|
|
489
|
+
((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
|
|
490
|
+
(a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
|
|
491
|
+
) {
|
|
492
|
+
return W;
|
|
493
|
+
} else if (
|
|
494
|
+
a_ne_lat === b_sw_lat &&
|
|
495
|
+
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
496
|
+
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
497
|
+
) {
|
|
498
|
+
return N;
|
|
499
|
+
} else if (
|
|
500
|
+
a_sw_lat === b_ne_lat &&
|
|
501
|
+
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
502
|
+
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
503
|
+
) {
|
|
504
|
+
return S;
|
|
505
|
+
} else if (
|
|
506
|
+
bs.tileX === 0 &&
|
|
507
|
+
as.tileX === Math.pow(2, as.tileZoom) - 1 &&
|
|
508
|
+
((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
|
|
509
|
+
(a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
|
|
510
|
+
) {
|
|
511
|
+
return E;
|
|
512
|
+
} else if (
|
|
513
|
+
as.tileX === 0 &&
|
|
514
|
+
bs.tileX === Math.pow(2, bs.tileZoom) - 1 &&
|
|
515
|
+
((a_ne_lat <= b_ne_lat && a_sw_lat >= b_sw_lat) ||
|
|
516
|
+
(a_ne_lat >= b_ne_lat && a_sw_lat <= b_sw_lat))
|
|
517
|
+
) {
|
|
518
|
+
return W;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
480
522
|
if (
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
523
|
+
as._tileGroup === 0 &&
|
|
524
|
+
bs._tileGroup === 1 &&
|
|
525
|
+
as.tileY === 0 &&
|
|
526
|
+
bs.tileY === Math.pow(2, bs.tileZoom) - 1 &&
|
|
527
|
+
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
528
|
+
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
484
529
|
) {
|
|
485
|
-
return
|
|
530
|
+
return N;
|
|
486
531
|
} else if (
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
532
|
+
as._tileGroup === 2 &&
|
|
533
|
+
bs._tileGroup === 0 &&
|
|
534
|
+
as.tileY === 0 &&
|
|
535
|
+
bs.tileY === Math.pow(2, bs.tileZoom) - 1 &&
|
|
536
|
+
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
537
|
+
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
490
538
|
) {
|
|
491
|
-
return
|
|
539
|
+
return N;
|
|
492
540
|
} else if (
|
|
493
|
-
|
|
541
|
+
bs._tileGroup === 1 &&
|
|
542
|
+
as._tileGroup === 0 &&
|
|
543
|
+
as.tileY === Math.pow(2, as.tileZoom) - 1 &&
|
|
544
|
+
bs.tileY === 0 &&
|
|
494
545
|
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
495
546
|
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
496
547
|
) {
|
|
497
|
-
return
|
|
548
|
+
return S;
|
|
498
549
|
} else if (
|
|
499
|
-
|
|
550
|
+
as._tileGroup === 1 &&
|
|
551
|
+
bs._tileGroup === 0 &&
|
|
552
|
+
as.tileY === Math.pow(2, as.tileZoom) - 1 &&
|
|
553
|
+
bs.tileY === 0 &&
|
|
500
554
|
((a_sw_lon >= b_sw_lon && a_ne_lon <= b_ne_lon) ||
|
|
501
555
|
(a_sw_lon <= b_sw_lon && a_ne_lon >= b_ne_lon))
|
|
502
556
|
) {
|
|
@@ -301,33 +301,38 @@ class RendererEvents extends Events {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
/**
|
|
304
|
-
* @
|
|
304
|
+
* @protected
|
|
305
305
|
*/
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
this.mouseState.leftButtonDown = true;
|
|
306
|
+
updateButtonsStates(buttons) {
|
|
307
|
+
var ms = this.mouseState;
|
|
308
|
+
if (buttons & LB_M) {
|
|
309
|
+
ms.leftButtonDown = true;
|
|
311
310
|
} else {
|
|
312
|
-
|
|
313
|
-
|
|
311
|
+
ms.leftButtonHold = false;
|
|
312
|
+
ms.leftButtonDown = false;
|
|
314
313
|
}
|
|
315
314
|
|
|
316
|
-
if (
|
|
317
|
-
|
|
315
|
+
if (buttons & RB_M) {
|
|
316
|
+
ms.rightButtonDown = true;
|
|
318
317
|
} else {
|
|
319
|
-
|
|
320
|
-
|
|
318
|
+
ms.rightButtonHold = false;
|
|
319
|
+
ms.rightButtonDown = false;
|
|
321
320
|
}
|
|
322
321
|
|
|
323
|
-
if (
|
|
324
|
-
|
|
322
|
+
if (buttons & MB_M) {
|
|
323
|
+
ms.middleButtonDown = true;
|
|
325
324
|
} else {
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
ms.middleButtonHold = false;
|
|
326
|
+
ms.middleButtonDown = false;
|
|
328
327
|
}
|
|
328
|
+
}
|
|
329
329
|
|
|
330
|
+
/**
|
|
331
|
+
* @private
|
|
332
|
+
*/
|
|
333
|
+
onMouseMove(event, sys) {
|
|
330
334
|
var ms = this.mouseState;
|
|
335
|
+
this.updateButtonsStates(sys.buttons)
|
|
331
336
|
ms.sys = event;
|
|
332
337
|
|
|
333
338
|
let ex = event.clientX,
|