@openglobus/openglobus-react 0.4.3 → 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 +30 -22
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -2
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -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.
|
|
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,18 +12223,17 @@ 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
|
-
new H(t.eye, e.direction).hitPlaneRes(r, i);
|
|
12231
|
-
}
|
|
12232
|
-
if (this._wheelPos.copy(i), t.isOrthographic) {
|
|
12233
|
-
if (this._wheelDist = this.renderer.getDistanceFromPixel(e.pos) || 0, !this._wheelDist) return;
|
|
12234
|
-
this._wheelDelta = e.wheelDelta, this._nx = e.nx, this._ny = e.ny;
|
|
12235
|
-
let r = i.sub(t.eye).normalize(), s = 8 * t.eye.distance(i);
|
|
12236
|
-
this.force.addA(r.scale(e.wheelDelta)).normalize().scale(s);
|
|
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;
|
|
12237
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
|
+
}
|
|
12238
12237
|
let r = i.sub(t.eye).normalize(), s = 8 * t.eye.distance(i);
|
|
12239
12238
|
this.force.addA(r.scale(e.wheelDelta)).normalize().scale(s);
|
|
12240
12239
|
}
|
|
@@ -12277,22 +12276,24 @@ Object.freeze(Object.defineProperty({ __proto__: null, AtmosphereConfig: class e
|
|
|
12277
12276
|
}
|
|
12278
12277
|
_handleMouseWheel() {
|
|
12279
12278
|
let o = this.renderer.activeCamera;
|
|
12280
|
-
if (o.isOrthographic) {
|
|
12281
|
-
o.eye = this._wheelPos.add(o.getBackward().scale(this._wheelDist)), o.focusDistance -= o.focusDistance * this.
|
|
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;
|
|
12282
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);
|
|
12283
|
-
o.eye.addA(s.add(r));
|
|
12284
|
-
} else o.eye = o.eye.add(this.vel.scaleTo(this.dt));
|
|
12285
|
-
o.update();
|
|
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());
|
|
12286
12284
|
}
|
|
12287
12285
|
onDraw() {
|
|
12288
|
-
this._updateVel(), this.
|
|
12286
|
+
this._updateVel(), this._handleMouseWheel();
|
|
12289
12287
|
}
|
|
12290
12288
|
get dt() {
|
|
12291
12289
|
return 1e-3 * this.renderer.handler.deltaTime;
|
|
12292
12290
|
}
|
|
12293
12291
|
_updateVel() {
|
|
12294
12292
|
let o = this.force.scale(1 / this.mass);
|
|
12295
|
-
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();
|
|
12296
12297
|
}
|
|
12297
12298
|
}, SimpleSkyBackground: wo, Sun: Vr, TimelineControl: class extends J {
|
|
12298
12299
|
constructor(o = {}) {
|
|
@@ -16380,6 +16381,13 @@ vec3 Uncharted2ToneMapping(vec3 color){color*=exposure;return saturate(Uncharted
|
|
|
16380
16381
|
return (e.direction || this.activeCamera.unproject(e.x, e.y)).scaleTo(t).addA(this.activeCamera.eye);
|
|
16381
16382
|
}
|
|
16382
16383
|
}
|
|
16384
|
+
getCartesianFromPixelAsync(e) {
|
|
16385
|
+
return new Promise((t, i) => {
|
|
16386
|
+
this._readDepthBuffer(() => {
|
|
16387
|
+
t(this.getCartesianFromPixel(e));
|
|
16388
|
+
});
|
|
16389
|
+
});
|
|
16390
|
+
}
|
|
16383
16391
|
getDepthMinDistance() {
|
|
16384
16392
|
let e = this.handler.canvas, t = e.width, i = e.height, r = wr, s = i * t, n = new N();
|
|
16385
16393
|
for (let a = 0; a < s; a++) {
|