@openglobus/openglobus-react 0.4.2 → 0.4.4
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/dist/index.js +37 -24
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +3 -3
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10094,7 +10094,7 @@ const dc = ["viewchange", "moveend", "flystart", "flyend", "flystop"], Po = cc.C
|
|
|
10094
10094
|
s.cameraFrustumIndex = this.frustums.length, this.frustums.push(s), this.frustumColors.push(s._pickingColorU[0], s._pickingColorU[1], s._pickingColorU[2]);
|
|
10095
10095
|
}
|
|
10096
10096
|
else {
|
|
10097
|
-
let t =
|
|
10097
|
+
let t = 1, i = 500, r = new an({ fov: this._viewAngle, aspect: this.getAspectRatio(), near: t, far: i });
|
|
10098
10098
|
r.cameraFrustumIndex = this.frustums.length, this.frustums.push(r), this.frustumColors.push(r._pickingColorU[0], r._pickingColorU[1], r._pickingColorU[2]);
|
|
10099
10099
|
}
|
|
10100
10100
|
this.FARTHEST_FRUSTUM_INDEX = this.frustums.length - 1, this.currentFrustumIndex = 0, this.frustumColorIndex = 0, this.isFirstPass = !1, this._projSizeConst = 0, this.set(e.eye || new m(0, 0, 1), e.look || new m(), e.up || new m(0, 1, 0));
|
|
@@ -12189,8 +12189,8 @@ Object.freeze(Object.defineProperty({ __proto__: null, AtmosphereConfig: class e
|
|
|
12189
12189
|
}
|
|
12190
12190
|
}, SimpleNavigation: class extends J {
|
|
12191
12191
|
constructor(o = {}) {
|
|
12192
|
-
super({ name: "SimpleNavigation", autoActivate: !0, ...o }), this._onMouseLeftButtonDown = (e) => {
|
|
12193
|
-
this._active && this.renderer && (this.renderer.handler.canvas.classList.add("ogGrabbingPoiner"), this._grabbedPoint = this.renderer.getCartesianFromPixel(e), this._grabbedScreenPoint.set(e.nx, e.ny), this._grabbedPoint && this._eye0.copy(this.renderer.activeCamera.eye));
|
|
12192
|
+
super({ name: "SimpleNavigation", autoActivate: !0, ...o }), this.focusVel = 0, this.focusForce = 0, this._nx = 0, this._ny = 0, this._onMouseLeftButtonDown = (e) => {
|
|
12193
|
+
this._active && this.renderer && (this.stop(), this.renderer.handler.canvas.classList.add("ogGrabbingPoiner"), this._grabbedPoint = this.renderer.getCartesianFromPixel(e), this._grabbedScreenPoint.set(e.nx, e.ny), this._grabbedPoint && this._eye0.copy(this.renderer.activeCamera.eye));
|
|
12194
12194
|
}, this._onMouseLeftButtonUp = (e) => {
|
|
12195
12195
|
this.renderer.handler.canvas.classList.remove("ogGrabbingPoiner"), e.x === e.prev_x && (e.y, e.prev_y);
|
|
12196
12196
|
}, this._onMouseLeftButtonHold = (e) => {
|
|
@@ -12214,8 +12214,8 @@ Object.freeze(Object.defineProperty({ __proto__: null, AtmosphereConfig: class e
|
|
|
12214
12214
|
let i = 0.5 / t.eye.distance(this._lookPos) * G;
|
|
12215
12215
|
i > 7e-3 ? i = 7e-3 : i < 3e-3 && (i = 3e-3), t.rotateHorizontal(i * (e.x - e.prev_x), !1, this._lookPos, this._up), t.rotateVertical(i * (e.y - e.prev_y), this._lookPos), t.update();
|
|
12216
12216
|
}
|
|
12217
|
-
}, this._onRDown = (e) => {
|
|
12218
|
-
if (this.renderer) if (this._lookPos = this.renderer.
|
|
12217
|
+
}, this._onRDown = async (e) => {
|
|
12218
|
+
if (this.renderer) if (this.stop(), this._lookPos = void 0, this._lookPos = await this.renderer.getCartesianFromPixelAsync(e.pos), this._lookPos) this._up = m.UP;
|
|
12219
12219
|
else {
|
|
12220
12220
|
const t = this.renderer.activeCamera;
|
|
12221
12221
|
let i = new we(m.ZERO, m.UP), r = new H(t.eye, e.direction);
|
|
@@ -12223,15 +12223,20 @@ Object.freeze(Object.defineProperty({ __proto__: null, AtmosphereConfig: class e
|
|
|
12223
12223
|
}
|
|
12224
12224
|
}, this._onMouseWheel = (e) => {
|
|
12225
12225
|
if (this.renderer) {
|
|
12226
|
-
let t = this.renderer.activeCamera
|
|
12227
|
-
if (
|
|
12228
|
-
i =
|
|
12229
|
-
|
|
12230
|
-
|
|
12226
|
+
let t = this.renderer.activeCamera;
|
|
12227
|
+
if (t.isOrthographic) {
|
|
12228
|
+
let i = t.frustums[0], r = -(i.right - i.left) * (0.5 - e.nx), s = (i.top - i.bottom) * (0.5 - e.ny), n = t.getUp().scale(s), a = t.getRight().scale(r), l = t.eye.add(a.add(n));
|
|
12229
|
+
this._wheelPos = l.add(t.getForward()), this._wheelDist = 1, this._nx = e.nx, this._ny = e.ny, this.focusForce = 0.05 * e.wheelDelta;
|
|
12230
|
+
} else {
|
|
12231
|
+
let i = this.renderer.getCartesianFromPixel(e);
|
|
12232
|
+
if (!i) {
|
|
12233
|
+
i = new m();
|
|
12234
|
+
let n = new we(m.ZERO, m.UP);
|
|
12235
|
+
new H(t.eye, e.direction).hitPlaneRes(n, i);
|
|
12236
|
+
}
|
|
12237
|
+
let r = i.sub(t.eye).normalize(), s = 8 * t.eye.distance(i);
|
|
12238
|
+
this.force.addA(r.scale(e.wheelDelta)).normalize().scale(s);
|
|
12231
12239
|
}
|
|
12232
|
-
this._wheelPos.copy(i);
|
|
12233
|
-
let r = i.sub(t.eye).normalize(), s = 8 * t.eye.distance(i);
|
|
12234
|
-
this.force.addA(r.scale(e.wheelDelta)).normalize().scale(s);
|
|
12235
12240
|
}
|
|
12236
12241
|
}, this.onCameraMoveForward = () => {
|
|
12237
12242
|
this.force.addA(this.renderer.activeCamera.getForward()).normalize();
|
|
@@ -12253,7 +12258,7 @@ Object.freeze(Object.defineProperty({ __proto__: null, AtmosphereConfig: class e
|
|
|
12253
12258
|
this.renderer.activeCamera.update();
|
|
12254
12259
|
}, this.onCameraRollRight = () => {
|
|
12255
12260
|
this.renderer.activeCamera.update();
|
|
12256
|
-
}, this.speed = o.speed || 1, this.force = new m(), this.vel = new m(), this.mass = 1, this._lookPos = void 0, this._grabbedPoint = void 0, this._grabbedScreenPoint = new N(), this._up = null, this._eye0 = new m(), this._wheelPos = new m();
|
|
12261
|
+
}, this.speed = o.speed || 1, this.force = new m(), this.vel = new m(), this.mass = 1, this._lookPos = void 0, this._grabbedPoint = void 0, this._grabbedScreenPoint = new N(), this._up = null, this._eye0 = new m(), this._wheelDist = 0, this._wheelPos = new m();
|
|
12257
12262
|
}
|
|
12258
12263
|
oninit() {
|
|
12259
12264
|
}
|
|
@@ -12270,24 +12275,25 @@ Object.freeze(Object.defineProperty({ __proto__: null, AtmosphereConfig: class e
|
|
|
12270
12275
|
o.events.off("mousewheel", this._onMouseWheel), o.events.off("keypress", W.KEY_W, this.onCameraMoveForward), o.events.off("keypress", W.KEY_S, this.onCameraMoveBackward), o.events.off("keypress", W.KEY_A, this.onCameraStrifeLeft), o.events.off("keypress", W.KEY_D, this.onCameraStrifeRight), o.events.off("keypress", W.KEY_UP, this.onCameraLookUp), o.events.off("keypress", W.KEY_DOWN, this.onCameraLookDown), o.events.off("keypress", W.KEY_LEFT, this.onCameraTurnLeft), o.events.off("keypress", W.KEY_RIGHT, this.onCameraTurnRight), o.events.off("keypress", W.KEY_Q, this.onCameraRollLeft), o.events.off("keypress", W.KEY_E, this.onCameraRollRight), o.events.off("rhold", this._onRHold), o.events.off("rdown", this._onRDown), o.events.off("lhold", this._onMouseLeftButtonHold), o.events.off("ldown", this._onMouseLeftButtonDown), o.events.off("lup", this._onMouseLeftButtonUp), o.events.off("draw", this.onDraw);
|
|
12271
12276
|
}
|
|
12272
12277
|
_handleMouseWheel() {
|
|
12273
|
-
let o = this.renderer.activeCamera
|
|
12274
|
-
if (o.
|
|
12275
|
-
|
|
12276
|
-
o.
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
}
|
|
12280
|
-
o.update();
|
|
12278
|
+
let o = this.renderer.activeCamera;
|
|
12279
|
+
if (o.isOrthographic && Math.abs(this.focusVel) > 0.01) {
|
|
12280
|
+
o.eye = this._wheelPos.add(o.getBackward().scale(this._wheelDist)), o.focusDistance -= o.focusDistance * this.focusVel * this.dt;
|
|
12281
|
+
let e = o.frustums[0], t = (e.right - e.left) * (0.5 - this._nx), i = -(e.top - e.bottom) * (0.5 - this._ny), r = o.getUp().scale(i), s = o.getRight().scale(t);
|
|
12282
|
+
o.eye.addA(s.add(r)), o.update();
|
|
12283
|
+
} else this.vel.length() > 0.01 && (o.eye = o.eye.add(this.vel.scaleTo(this.dt)), o.update());
|
|
12281
12284
|
}
|
|
12282
12285
|
onDraw() {
|
|
12283
|
-
this._updateVel(), this.
|
|
12286
|
+
this._updateVel(), this._handleMouseWheel();
|
|
12284
12287
|
}
|
|
12285
12288
|
get dt() {
|
|
12286
12289
|
return 1e-3 * this.renderer.handler.deltaTime;
|
|
12287
12290
|
}
|
|
12288
12291
|
_updateVel() {
|
|
12289
12292
|
let o = this.force.scale(1 / this.mass);
|
|
12290
|
-
this.vel.addA(o), this.vel.scale(0.77), this.force.set(0, 0, 0);
|
|
12293
|
+
this.vel.addA(o), this.vel.scale(0.77), this.force.set(0, 0, 0), this.focusVel += this.focusForce, this.focusVel *= 0.77, this.focusForce = 0;
|
|
12294
|
+
}
|
|
12295
|
+
stop() {
|
|
12296
|
+
this.focusVel = 0, this.vel.clear();
|
|
12291
12297
|
}
|
|
12292
12298
|
}, SimpleSkyBackground: wo, Sun: Vr, TimelineControl: class extends J {
|
|
12293
12299
|
constructor(o = {}) {
|
|
@@ -16375,6 +16381,13 @@ vec3 Uncharted2ToneMapping(vec3 color){color*=exposure;return saturate(Uncharted
|
|
|
16375
16381
|
return (e.direction || this.activeCamera.unproject(e.x, e.y)).scaleTo(t).addA(this.activeCamera.eye);
|
|
16376
16382
|
}
|
|
16377
16383
|
}
|
|
16384
|
+
getCartesianFromPixelAsync(e) {
|
|
16385
|
+
return new Promise((t, i) => {
|
|
16386
|
+
this._readDepthBuffer(() => {
|
|
16387
|
+
t(this.getCartesianFromPixel(e));
|
|
16388
|
+
});
|
|
16389
|
+
});
|
|
16390
|
+
}
|
|
16378
16391
|
getDepthMinDistance() {
|
|
16379
16392
|
let e = this.handler.canvas, t = e.width, i = e.height, r = wr, s = i * t, n = new N();
|
|
16380
16393
|
for (let a = 0; a < s; a++) {
|