@openglobus/og 0.19.2 → 0.19.3
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/lib/@openglobus/og.esm.js +1 -1
- package/lib/@openglobus/og.esm.js.map +1 -1
- package/lib/@openglobus/og.umd.js +1 -1
- package/lib/@openglobus/og.umd.js.map +1 -1
- package/lib/js/control/KeyboardNavigation.js +10 -10
- package/lib/js/control/MouseNavigation.js +4 -8
- package/lib/js/ellipsoid/Ellipsoid.d.ts +7 -1
- package/lib/js/ellipsoid/Ellipsoid.js +7 -1
- package/lib/js/quadTree/Node.js +14 -65
- package/lib/js/renderer/Renderer.js +6 -5
- package/lib/js/segment/Segment.d.ts +1 -0
- package/lib/js/segment/Segment.js +8 -3
- package/lib/js/shaders/drawnode.js +18 -14
- package/lib/js/shaders/geoObject.js +8 -8
- package/package.json +1 -1
|
@@ -54,19 +54,19 @@ export class KeyboardNavigation extends Control {
|
|
|
54
54
|
}
|
|
55
55
|
onCameraMoveForward() {
|
|
56
56
|
let cam = this.planet.camera;
|
|
57
|
-
cam.slide(0, 0, -cam.
|
|
57
|
+
cam.slide(0, 0, -cam.getAltitude() / this.step);
|
|
58
58
|
}
|
|
59
59
|
onCameraMoveBackward() {
|
|
60
60
|
let cam = this.planet.camera;
|
|
61
|
-
cam.slide(0, 0, cam.
|
|
61
|
+
cam.slide(0, 0, cam.getAltitude() / this.step);
|
|
62
62
|
}
|
|
63
63
|
onCameraStrifeLeft() {
|
|
64
64
|
let cam = this.planet.camera;
|
|
65
|
-
cam.slide(-cam.
|
|
65
|
+
cam.slide(-cam.getAltitude() / this.step, 0, 0);
|
|
66
66
|
}
|
|
67
67
|
onCameraStrifeRight() {
|
|
68
68
|
let cam = this.planet.camera;
|
|
69
|
-
cam.slide(cam.
|
|
69
|
+
cam.slide(cam.getAltitude() / this.step, 0, 0);
|
|
70
70
|
}
|
|
71
71
|
onCameraLookUp() {
|
|
72
72
|
let cam = this.planet.camera;
|
|
@@ -74,7 +74,7 @@ export class KeyboardNavigation extends Control {
|
|
|
74
74
|
cam.pitch(15 / this.renderer.handler.deltaTime);
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
cam.rotateVertical((cam.
|
|
77
|
+
cam.rotateVertical((cam.getAltitude() / 3000000) * math.RADIANS, Vec3.ZERO);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
onCameraLookDown() {
|
|
@@ -83,7 +83,7 @@ export class KeyboardNavigation extends Control {
|
|
|
83
83
|
cam.pitch(-15 / this.renderer.handler.deltaTime);
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
|
-
cam.rotateVertical((-cam.
|
|
86
|
+
cam.rotateVertical((-cam.getAltitude() / 3000000) * math.RADIANS, Vec3.ZERO);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
onCameraLookLeft() {
|
|
@@ -92,7 +92,7 @@ export class KeyboardNavigation extends Control {
|
|
|
92
92
|
cam.roll(15 / this.renderer.handler.deltaTime);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
cam.rotateHorizontal((cam.
|
|
95
|
+
cam.rotateHorizontal((cam.getAltitude() / 3000000) * math.RADIANS);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
onCameraLookRight() {
|
|
@@ -101,7 +101,7 @@ export class KeyboardNavigation extends Control {
|
|
|
101
101
|
cam.roll(-15 / this.renderer.handler.deltaTime);
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
|
-
cam.rotateHorizontal((-cam.
|
|
104
|
+
cam.rotateHorizontal((-cam.getAltitude() / 3000000) * math.RADIANS);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
onCameraTurnLeft() {
|
|
@@ -110,7 +110,7 @@ export class KeyboardNavigation extends Control {
|
|
|
110
110
|
cam.yaw(15 / this.renderer.handler.deltaTime);
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
113
|
-
cam.rotateHorizontal((cam.
|
|
113
|
+
cam.rotateHorizontal((cam.getAltitude() / 3000000) * math.RADIANS);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
onCameraTurnRight() {
|
|
@@ -119,7 +119,7 @@ export class KeyboardNavigation extends Control {
|
|
|
119
119
|
cam.yaw(-15 / this.renderer.handler.deltaTime);
|
|
120
120
|
}
|
|
121
121
|
else {
|
|
122
|
-
cam.rotateHorizontal((-cam.
|
|
122
|
+
cam.rotateHorizontal((-cam.getAltitude() / 3000000) * math.RADIANS, false, Vec3.ZERO);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
// from CompassButton._onClick()
|
|
@@ -275,10 +275,13 @@ export class MouseNavigation extends Control {
|
|
|
275
275
|
const cam = this.planet.camera;
|
|
276
276
|
if (this.pointOnEarth && e.moving) {
|
|
277
277
|
this.renderer.controlsBag.scaleRot = 1.0;
|
|
278
|
-
let l = (0.5 / cam.eye.distance(this.pointOnEarth)) *
|
|
278
|
+
let l = (0.5 / cam.eye.distance(this.pointOnEarth)) * cam._lonLat.height * math.RADIANS;
|
|
279
279
|
if (l > 0.007) {
|
|
280
280
|
l = 0.007;
|
|
281
281
|
}
|
|
282
|
+
else if (l < 0.003) {
|
|
283
|
+
l = 0.003;
|
|
284
|
+
}
|
|
282
285
|
cam.rotateHorizontal(l * (e.x - e.prev_x), false, this.pointOnEarth, this.earthUp);
|
|
283
286
|
cam.rotateVertical(l * (e.y - e.prev_y), this.pointOnEarth, this.minSlope);
|
|
284
287
|
}
|
|
@@ -303,13 +306,6 @@ export class MouseNavigation extends Control {
|
|
|
303
306
|
if (this.stepIndex) {
|
|
304
307
|
r.controlsBag.scaleRot = 1.0;
|
|
305
308
|
const sf = this.stepsForward[this.stepsCount - this.stepIndex--];
|
|
306
|
-
let maxAlt = cam.maxAltitude + this.planet.ellipsoid.polarSize;
|
|
307
|
-
let minAlt = cam.minAltitude + this.planet.ellipsoid.polarSize;
|
|
308
|
-
const camAlt = sf.eye.length();
|
|
309
|
-
if (camAlt > maxAlt || camAlt < minAlt && this._wheelDirection > 0) {
|
|
310
|
-
this._wheelDirection = +1;
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
309
|
cam.eye = sf.eye;
|
|
314
310
|
cam._u = sf.v;
|
|
315
311
|
cam._r = sf.u;
|
|
@@ -145,6 +145,12 @@ declare class Ellipsoid {
|
|
|
145
145
|
* @returns {LonLat} - Destination point coordinates
|
|
146
146
|
*/
|
|
147
147
|
getGreatCircleDestination(lonLat: LonLat, azimuth: number, dist: number): LonLat;
|
|
148
|
+
/**
|
|
149
|
+
* Returns inverse Geodesic solution for two points
|
|
150
|
+
* @param {LonLat} lonLat1 - start coordinates point
|
|
151
|
+
* @param {LonLat} lonLat2 - end coordinates point
|
|
152
|
+
* @returns {IInverseResult} - Contains distance, initialAzimuth, and finalAzimuth values
|
|
153
|
+
*/
|
|
148
154
|
inverse(lonLat1: LonLat, lonLat2: LonLat): IInverseResult;
|
|
149
155
|
/**
|
|
150
156
|
* Calculates the destination point given start point lat / lon, azimuth(deg) and distance (m).
|
|
@@ -153,7 +159,7 @@ declare class Ellipsoid {
|
|
|
153
159
|
* @param {LonLat} lonLat - Origin coordinates
|
|
154
160
|
* @param {number} azimuth - View azimuth in degrees
|
|
155
161
|
* @param {number} dist - Distance to the destination point coordinates in meters
|
|
156
|
-
* @returns {LonLat} - Destination point coordinates
|
|
162
|
+
* @returns {{ destination: LonLat; finalAzimuth: number }} - Destination point coordinates
|
|
157
163
|
*/
|
|
158
164
|
direct(lonLat: LonLat, azimuth: number, dist: number): IDirectResult;
|
|
159
165
|
/**
|
|
@@ -229,6 +229,12 @@ class Ellipsoid {
|
|
|
229
229
|
getGreatCircleDestination(lonLat, azimuth, dist) {
|
|
230
230
|
return this.direct(lonLat, azimuth, dist).destination;
|
|
231
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Returns inverse Geodesic solution for two points
|
|
234
|
+
* @param {LonLat} lonLat1 - start coordinates point
|
|
235
|
+
* @param {LonLat} lonLat2 - end coordinates point
|
|
236
|
+
* @returns {IInverseResult} - Contains distance, initialAzimuth, and finalAzimuth values
|
|
237
|
+
*/
|
|
232
238
|
inverse(lonLat1, lonLat2) {
|
|
233
239
|
let a = this._a, b = this._b, f = this._flattening;
|
|
234
240
|
const fi1 = lonLat1.lat * RADIANS, lambda1 = lonLat1.lon * RADIANS;
|
|
@@ -282,7 +288,7 @@ class Ellipsoid {
|
|
|
282
288
|
* @param {LonLat} lonLat - Origin coordinates
|
|
283
289
|
* @param {number} azimuth - View azimuth in degrees
|
|
284
290
|
* @param {number} dist - Distance to the destination point coordinates in meters
|
|
285
|
-
* @returns {LonLat} - Destination point coordinates
|
|
291
|
+
* @returns {{ destination: LonLat; finalAzimuth: number }} - Destination point coordinates
|
|
286
292
|
*/
|
|
287
293
|
direct(lonLat, azimuth, dist) {
|
|
288
294
|
let lon1 = lonLat.lon, lat1 = lonLat.lat;
|
package/lib/js/quadTree/Node.js
CHANGED
|
@@ -7,7 +7,7 @@ import { MAX, MIN } from "../math";
|
|
|
7
7
|
import { MAX_LAT } from "../mercator";
|
|
8
8
|
import { Vec2 } from "../math/Vec2";
|
|
9
9
|
import { Vec3 } from "../math/Vec3";
|
|
10
|
-
import { E, MAX_RENDERED_NODES, N, NE, NEIGHBOUR, NOTRENDERING, NW, OPPART, OPSIDE, PARTOFFSET, RENDERING, S, SE, SW,
|
|
10
|
+
import { E, MAX_RENDERED_NODES, N, NE, NEIGHBOUR, NOTRENDERING, NW, OPPART, OPSIDE, PARTOFFSET, RENDERING, S, SE, SW, W, WALKTHROUGH } from "./quadTree";
|
|
11
11
|
import { TILEGROUP_COMMON, TILEGROUP_NORTH, TILEGROUP_SOUTH } from "../segment/Segment";
|
|
12
12
|
let _tempHigh = new Vec3(), _tempLow = new Vec3();
|
|
13
13
|
const _vertOrder = [
|
|
@@ -202,15 +202,17 @@ class Node {
|
|
|
202
202
|
}
|
|
203
203
|
if (this.inFrustum || this._cameraInside || seg.tileZoom < 3) {
|
|
204
204
|
let h = Math.abs(cam._lonLat.height);
|
|
205
|
-
let
|
|
206
|
-
|
|
207
|
-
let altVis = seg.tileZoom
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
205
|
+
let horizonDist = cam.eye.length2() - this.planet.ellipsoid.polarSizeSqr;
|
|
206
|
+
horizonDist = horizonDist < 106876472875.63281 * planet._heightFactor ? 106876472875.63281 * planet._heightFactor : horizonDist;
|
|
207
|
+
let altVis = seg.tileZoom < 2 || seg.tileZoom > 19 ||
|
|
208
|
+
/* Could be replaced with camera frustum always looking down check,
|
|
209
|
+
and not to go througn nodes from the oppositeside of the globe*/
|
|
210
|
+
(seg.tileZoom < 5 && !seg.terrainReady);
|
|
211
|
+
altVis = altVis ||
|
|
212
|
+
cam.eye.distance2(seg._sw) < horizonDist ||
|
|
213
|
+
cam.eye.distance2(seg._nw) < horizonDist ||
|
|
214
|
+
cam.eye.distance2(seg._ne) < horizonDist ||
|
|
215
|
+
cam.eye.distance2(seg._se) < horizonDist;
|
|
214
216
|
if ((this.inFrustum && (altVis || h > 10000.0)) || this._cameraInside) {
|
|
215
217
|
//@todo: replace to the strategy
|
|
216
218
|
seg._collectVisibleNodes();
|
|
@@ -218,7 +220,8 @@ class Node {
|
|
|
218
220
|
if (seg.tileZoom < 2) {
|
|
219
221
|
this.traverseNodes(cam, maxZoom, terrainReadySegment, stopLoading, zoomPassNode);
|
|
220
222
|
}
|
|
221
|
-
else if (seg.terrainReady && (!maxZoom && cam.projectedSize(seg.bsphere.center, seg._plainRadius) < planet.lodSize
|
|
223
|
+
else if (seg.terrainReady && (!maxZoom && cam.projectedSize(seg.bsphere.center, seg._plainRadius) < planet.lodSize
|
|
224
|
+
|| maxZoom && ((seg.tileZoom === maxZoom) || !altVis))) {
|
|
222
225
|
if (altVis) {
|
|
223
226
|
seg.passReady = true;
|
|
224
227
|
this.renderNode(this.inFrustum, !this.inFrustum, terrainReadySegment, stopLoading);
|
|
@@ -476,60 +479,6 @@ class Node {
|
|
|
476
479
|
}
|
|
477
480
|
return -1;
|
|
478
481
|
}
|
|
479
|
-
// // TODO: test test test
|
|
480
|
-
// public ___getCommonSide___(b: Node) {
|
|
481
|
-
// let a = this, as = a.segment, bs = b.segment;
|
|
482
|
-
//
|
|
483
|
-
// if (as.tileZoom === bs.tileZoom) {
|
|
484
|
-
// return as.getNeighborSide(bs);
|
|
485
|
-
// } else if (as.tileZoom > bs.tileZoom) {
|
|
486
|
-
// let dz = as.tileZoom - bs.tileZoom, i = dz, p: Node = this;
|
|
487
|
-
//
|
|
488
|
-
// while (i--) {
|
|
489
|
-
// p = p.parentNode!;
|
|
490
|
-
// }
|
|
491
|
-
//
|
|
492
|
-
// let side = p.segment.getNeighborSide(bs);
|
|
493
|
-
//
|
|
494
|
-
// if (side !== -1) {
|
|
495
|
-
// i = dz;
|
|
496
|
-
// p = this;
|
|
497
|
-
// let _n = true;
|
|
498
|
-
//
|
|
499
|
-
// while (i--) {
|
|
500
|
-
// _n = _n && COMSIDE[p.partId][side];
|
|
501
|
-
// }
|
|
502
|
-
//
|
|
503
|
-
// if (_n) {
|
|
504
|
-
// return side;
|
|
505
|
-
// }
|
|
506
|
-
// }
|
|
507
|
-
// } else {
|
|
508
|
-
// let dz = bs.tileZoom - as.tileZoom, i = dz, p = b;
|
|
509
|
-
//
|
|
510
|
-
// while (i--) {
|
|
511
|
-
// p = p.parentNode!;
|
|
512
|
-
// }
|
|
513
|
-
//
|
|
514
|
-
// let side = p.segment.getNeighborSide(as);
|
|
515
|
-
//
|
|
516
|
-
// if (side !== -1) {
|
|
517
|
-
// i = dz;
|
|
518
|
-
// p = b;
|
|
519
|
-
// let _n = true;
|
|
520
|
-
//
|
|
521
|
-
// while (i--) {
|
|
522
|
-
// _n = _n && COMSIDE[p.partId][side];
|
|
523
|
-
// }
|
|
524
|
-
//
|
|
525
|
-
// if (_n) {
|
|
526
|
-
// return OPSIDE[side];
|
|
527
|
-
// }
|
|
528
|
-
// }
|
|
529
|
-
// }
|
|
530
|
-
//
|
|
531
|
-
// return -1;
|
|
532
|
-
// }
|
|
533
482
|
whileNormalMapCreating() {
|
|
534
483
|
const seg = this.segment;
|
|
535
484
|
if (!seg.terrainIsLoading && seg.terrainExists && !seg._inTheQueue) {
|
|
@@ -720,7 +720,8 @@ class Renderer {
|
|
|
720
720
|
this.enableBlendDefault();
|
|
721
721
|
e.dispatch(e.draw, this);
|
|
722
722
|
let frustums = this.activeCamera.frustums;
|
|
723
|
-
let pointerEvent =
|
|
723
|
+
let pointerEvent = e.pointerEvent();
|
|
724
|
+
let mouseHold = e.mouseState.leftButtonDown || e.mouseState.rightButtonDown;
|
|
724
725
|
// Rendering scene nodes and entityCollections
|
|
725
726
|
let rn = this._renderNodesArr;
|
|
726
727
|
let k = frustums.length;
|
|
@@ -740,21 +741,21 @@ class Renderer {
|
|
|
740
741
|
this._drawTransparentEntityCollections();
|
|
741
742
|
this._clearEntityCollectionQueue();
|
|
742
743
|
e.dispatch(e.drawtransparent, this);
|
|
743
|
-
if (pointerEvent) {
|
|
744
|
+
if (pointerEvent && !mouseHold) {
|
|
744
745
|
this._drawPickingBuffer();
|
|
745
|
-
this.__useDistanceFramebuffer__ && this._drawDistanceBuffer();
|
|
746
746
|
}
|
|
747
|
+
this.__useDistanceFramebuffer__ && this._drawDistanceBuffer();
|
|
747
748
|
}
|
|
748
749
|
sceneFramebuffer.deactivate();
|
|
749
750
|
this.blitFramebuffer && sceneFramebuffer.blitTo(this.blitFramebuffer, 0);
|
|
750
751
|
if (pointerEvent) {
|
|
751
|
-
// It works ONLY for 0 (closest) frustum
|
|
752
752
|
if (h.isWebGl2()) {
|
|
753
|
+
// It works ONLY for 0 (closest) frustum
|
|
753
754
|
this._drawDepthBuffer();
|
|
754
755
|
}
|
|
755
756
|
this._readPickingBuffer();
|
|
756
|
-
this.__useDistanceFramebuffer__ && this._readDistanceBuffer();
|
|
757
757
|
}
|
|
758
|
+
this.__useDistanceFramebuffer__ && this._readDistanceBuffer();
|
|
758
759
|
// Tone mapping followed by rendering on the screen
|
|
759
760
|
this._fnScreenFrame();
|
|
760
761
|
e.dispatch(e.postdraw, this);
|
|
@@ -228,6 +228,7 @@ declare class Segment {
|
|
|
228
228
|
* @todo: looks like it could be simplified in Segment contructor
|
|
229
229
|
*/
|
|
230
230
|
_setExtentLonLat(): void;
|
|
231
|
+
protected _createExtentNormals(): void;
|
|
231
232
|
createBoundsByExtent(): void;
|
|
232
233
|
createBoundsByParent(): void;
|
|
233
234
|
setBoundingSphere(x: number, y: number, z: number, v: Vec3): void;
|
|
@@ -283,7 +283,8 @@ class Segment {
|
|
|
283
283
|
this.node.equalizedSideWithNodeId[neighborSide] !== neigborNode.equalizedSideWithNodeId[OPSIDE[neighborSide]];
|
|
284
284
|
}
|
|
285
285
|
equalize() {
|
|
286
|
-
|
|
286
|
+
// Equalization doesnt work correctly for gridSize equals 2
|
|
287
|
+
if (this.gridSize < 2) {
|
|
287
288
|
return;
|
|
288
289
|
}
|
|
289
290
|
this.readyToEngage = true;
|
|
@@ -621,7 +622,7 @@ class Segment {
|
|
|
621
622
|
_setExtentLonLat() {
|
|
622
623
|
this._extentLonLat = this._extent.inverseMercator();
|
|
623
624
|
}
|
|
624
|
-
|
|
625
|
+
_createExtentNormals() {
|
|
625
626
|
const ellipsoid = this.planet.ellipsoid;
|
|
626
627
|
const extent = this._extentLonLat;
|
|
627
628
|
const coord_sw = ellipsoid.geodeticToCartesian(extent.southWest.lon, extent.southWest.lat);
|
|
@@ -632,7 +633,10 @@ class Segment {
|
|
|
632
633
|
this._nw.copy(coord_nw);
|
|
633
634
|
this._ne.copy(coord_ne);
|
|
634
635
|
this._se.copy(coord_se);
|
|
635
|
-
|
|
636
|
+
}
|
|
637
|
+
createBoundsByExtent() {
|
|
638
|
+
this._createExtentNormals();
|
|
639
|
+
this.setBoundingVolume3v(this._sw, this._ne);
|
|
636
640
|
}
|
|
637
641
|
createBoundsByParent() {
|
|
638
642
|
let pn = this.node;
|
|
@@ -694,6 +698,7 @@ class Segment {
|
|
|
694
698
|
else {
|
|
695
699
|
coords_rb = Vec3.add(vs.scaleTo(1 - vi_x / insideSize), ve.scaleTo(1 - vi_y / insideSize)).addA(v_rb);
|
|
696
700
|
}
|
|
701
|
+
this._createExtentNormals();
|
|
697
702
|
this.setBoundingVolume3v(coords_lt, coords_rb);
|
|
698
703
|
}
|
|
699
704
|
}
|
|
@@ -219,10 +219,10 @@ export function drawnode_screen_wl_webgl1NoAtmos() {
|
|
|
219
219
|
float maxH = minH * 3.0;
|
|
220
220
|
float nightCoef = getLerpValue(minH, maxH, camHeight) * nightTextureCoefficient;
|
|
221
221
|
|
|
222
|
-
if(camHeight > 6000000.0)
|
|
223
|
-
{
|
|
224
|
-
|
|
225
|
-
}
|
|
222
|
+
// if(camHeight > 6000000.0)
|
|
223
|
+
// {
|
|
224
|
+
// normal = normalize(v_vertex);
|
|
225
|
+
// }
|
|
226
226
|
|
|
227
227
|
vec3 lightDir = normalize(sunPos);
|
|
228
228
|
vec3 viewDir = normalize(cameraPosition - v_vertex);
|
|
@@ -406,10 +406,10 @@ export function drawnode_screen_wl_webgl2NoAtmos() {
|
|
|
406
406
|
float maxH = minH * 3.0;
|
|
407
407
|
float nightCoef = getLerpValue(minH, maxH, camHeight) * nightTextureCoefficient;
|
|
408
408
|
|
|
409
|
-
if(camHeight > 6000000.0)
|
|
410
|
-
{
|
|
411
|
-
|
|
412
|
-
}
|
|
409
|
+
// if(camHeight > 6000000.0)
|
|
410
|
+
// {
|
|
411
|
+
// normal = normalize(v_vertex);
|
|
412
|
+
// }
|
|
413
413
|
|
|
414
414
|
vec3 lightDir = normalize(sunPos);
|
|
415
415
|
vec3 viewDir = normalize(cameraPosition - v_vertex);
|
|
@@ -661,8 +661,12 @@ export function drawnode_screen_wl_webgl2Atmos() {
|
|
|
661
661
|
bool hitGround = intersectSphere(camPos, rayDirection, BOTTOM_RADIUS, distanceToGround) && distanceToGround > 0.0;
|
|
662
662
|
|
|
663
663
|
// Fix black dots on the edge of atmosphere
|
|
664
|
-
if(camHeight < 700000.0 || !hitGround)
|
|
665
|
-
{
|
|
664
|
+
// if(camHeight < 700000.0 || !hitGround)
|
|
665
|
+
// {
|
|
666
|
+
// distanceToGround = distance(camPos, v_vertex * SPHERE_TO_ELLIPSOID_SCALE);
|
|
667
|
+
// }
|
|
668
|
+
|
|
669
|
+
if(length(v_vertex * SPHERE_TO_ELLIPSOID_SCALE) > BOTTOM_RADIUS){
|
|
666
670
|
distanceToGround = distance(camPos, v_vertex * SPHERE_TO_ELLIPSOID_SCALE);
|
|
667
671
|
}
|
|
668
672
|
|
|
@@ -725,10 +729,10 @@ export function drawnode_screen_wl_webgl2Atmos() {
|
|
|
725
729
|
float maxH = minH * 3.0;
|
|
726
730
|
float nightCoef = getLerpValue(minH, maxH, camHeight) * nightTextureCoefficient;
|
|
727
731
|
|
|
728
|
-
if(camHeight > 6000000.0)
|
|
729
|
-
{
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
+
// if(camHeight > 6000000.0)
|
|
733
|
+
// {
|
|
734
|
+
// normal = normalize(v_vertex);
|
|
735
|
+
// }
|
|
732
736
|
|
|
733
737
|
vec3 lightDir = normalize(sunPos);
|
|
734
738
|
vec3 viewDir = normalize(cameraPosition - v_vertex);
|
|
@@ -51,7 +51,7 @@ export const geo_object = () => new Program("geo_object", {
|
|
|
51
51
|
varying vec4 vColor;
|
|
52
52
|
varying float vDispose;
|
|
53
53
|
varying vec2 vTexCoords;
|
|
54
|
-
varying float useLighting;
|
|
54
|
+
//varying float useLighting;
|
|
55
55
|
|
|
56
56
|
const float PI = 3.141592653589793;
|
|
57
57
|
|
|
@@ -69,10 +69,10 @@ export const geo_object = () => new Program("geo_object", {
|
|
|
69
69
|
vec3 look = cameraPosition - position;
|
|
70
70
|
float lookLength = length(look);
|
|
71
71
|
|
|
72
|
-
useLighting = 1.0;
|
|
73
|
-
if(lookLength > 2000000.0){
|
|
74
|
-
|
|
75
|
-
}
|
|
72
|
+
// useLighting = 1.0;
|
|
73
|
+
// if(lookLength > 2000000.0){
|
|
74
|
+
// useLighting = 0.0;
|
|
75
|
+
// }
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
vColor = aColor;
|
|
@@ -142,13 +142,13 @@ export const geo_object = () => new Program("geo_object", {
|
|
|
142
142
|
varying vec4 vColor;
|
|
143
143
|
varying vec3 vNormal;
|
|
144
144
|
varying vec2 vTexCoords;
|
|
145
|
-
varying float useLighting;
|
|
145
|
+
//varying float useLighting;
|
|
146
146
|
|
|
147
147
|
void main(void) {
|
|
148
148
|
|
|
149
149
|
vec3 lightWeighting = vec3(1.0);
|
|
150
150
|
|
|
151
|
-
if(useLighting != 0.0){
|
|
151
|
+
//if(useLighting != 0.0){
|
|
152
152
|
vec3 normal = normalize(vNormal);
|
|
153
153
|
vec3 lightDir = normalize(lightsPositions[0]);
|
|
154
154
|
vec3 viewDir = normalize(cameraPosition - v_vertex);
|
|
@@ -157,7 +157,7 @@ export const geo_object = () => new Program("geo_object", {
|
|
|
157
157
|
float specularLightWeighting = pow( reflection, lightsParamsf[0]);
|
|
158
158
|
float diffuseLightWeighting = max(dot(normal, lightDir), 0.0);
|
|
159
159
|
lightWeighting = lightsParamsv[0] + lightsParamsv[1] * diffuseLightWeighting + lightsParamsv[2] * specularLightWeighting;
|
|
160
|
-
}
|
|
160
|
+
//}
|
|
161
161
|
|
|
162
162
|
if(uUseTexture > 0.0) {
|
|
163
163
|
vec4 tColor = texture2D(uTexture, vTexCoords);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3",
|
|
4
4
|
"description": "[openglobus](https://www.openglobus.org/) is a javascript/typescript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers, and 3D objects. It uses the WebGL technology, open source, and completely free.",
|
|
5
5
|
"directories": {
|
|
6
6
|
"example": "./sandbox"
|