@openglobus/og 0.10.6 → 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/package.json +10 -7
- package/src/og/Extent.js +1 -1
- package/src/og/LonLat.js +7 -2
- package/src/og/Popup.js +2 -1
- package/src/og/camera/PlanetCamera.js +4 -2
- 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/KML.js +7 -5
- 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/scene/Planet.js +14 -4
- package/src/og/segment/SegmentLonLat.js +7 -0
- package/src/og/terrain/GlobusTerrain.js +4 -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 -1022
- 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/scene/Planet.js
CHANGED
|
@@ -100,7 +100,7 @@ const EVENT_NAMES = [
|
|
|
100
100
|
* @fires og.scene.Planet#layervisibilitychange
|
|
101
101
|
* @fires og.scene.Planet#geoimageadd
|
|
102
102
|
*/
|
|
103
|
-
class Planet extends RenderNode {
|
|
103
|
+
export class Planet extends RenderNode {
|
|
104
104
|
constructor(options = {}) {
|
|
105
105
|
super(options.name);
|
|
106
106
|
|
|
@@ -675,6 +675,10 @@ class Planet extends RenderNode {
|
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
677
|
|
|
678
|
+
this.renderer.events.on("resize", () => {
|
|
679
|
+
this._renderCompletedActivated = false;
|
|
680
|
+
});
|
|
681
|
+
|
|
678
682
|
// Initialize texture coordinates buffer pool
|
|
679
683
|
this._textureCoordsBufferCache = [];
|
|
680
684
|
|
|
@@ -1092,7 +1096,9 @@ class Planet extends RenderNode {
|
|
|
1092
1096
|
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
1093
1097
|
|
|
1094
1098
|
if (frustumIndex === cam.FARTHEST_FRUSTUM_INDEX) {
|
|
1095
|
-
this.
|
|
1099
|
+
if (!this._renderCompletedActivated || this.camera._moved) {
|
|
1100
|
+
this._collectRenderNodes();
|
|
1101
|
+
}
|
|
1096
1102
|
|
|
1097
1103
|
// Here is the planet node dispatches a draw event before
|
|
1098
1104
|
// rendering begins and we have got render nodes.
|
|
@@ -1696,6 +1702,9 @@ class Planet extends RenderNode {
|
|
|
1696
1702
|
* @param {og.Vec3} [look] - Camera "look at" point.
|
|
1697
1703
|
* @param {og.Vec3} [up] - Camera UP vector on the end of a flying.
|
|
1698
1704
|
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
1705
|
+
* @param [completeCallback]
|
|
1706
|
+
* @param [startCallback]
|
|
1707
|
+
* @param [frameCallback]
|
|
1699
1708
|
*/
|
|
1700
1709
|
flyCartesian(cartesian, look, up, ampl, completeCallback, startCallback, frameCallback) {
|
|
1701
1710
|
this.renderer.activeCamera.flyCartesian(
|
|
@@ -1716,6 +1725,9 @@ class Planet extends RenderNode {
|
|
|
1716
1725
|
* @param {og.Vec3} [look] - Camera "look at" point on the end of a flying.
|
|
1717
1726
|
* @param {og.Vec3} [up] - Camera UP vector on the end of a flying.
|
|
1718
1727
|
* @param {Number} [ampl] - Altitude amplitude factor.
|
|
1728
|
+
* @param [completeCallback]
|
|
1729
|
+
* @param [startCallback]
|
|
1730
|
+
* @param [frameCallback]
|
|
1719
1731
|
*/
|
|
1720
1732
|
flyLonLat(lonlat, look, up, ampl, completeCallback, startCallback, frameCallback) {
|
|
1721
1733
|
this.renderer.activeCamera.flyLonLat(
|
|
@@ -1766,5 +1778,3 @@ class Planet extends RenderNode {
|
|
|
1766
1778
|
}
|
|
1767
1779
|
}
|
|
1768
1780
|
}
|
|
1769
|
-
|
|
1770
|
-
export { Planet };
|
|
@@ -93,6 +93,13 @@ SegmentLonLat.prototype._assignTileIndexes = function () {
|
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
var p2 = Math.pow(2, tileZoom);
|
|
97
|
+
this.tileXE = (this.tileX + 1) % p2;
|
|
98
|
+
this.tileXW = (p2 + this.tileX - 1) % p2;
|
|
99
|
+
|
|
100
|
+
this.tileYN = this.tileY - 1;
|
|
101
|
+
this.tileYS = this.tileY + 1;
|
|
102
|
+
|
|
96
103
|
this.tileIndex = Layer.getTileIndex(this.tileX, this.tileY, tileZoom);
|
|
97
104
|
};
|
|
98
105
|
|