mirror of
https://github.com/openglobus/openglobus.git
synced 2025-12-08 19:25:27 +00:00
Merge branch 'master' of github.com:openglobus/openglobus
This commit is contained in:
commit
b6f835521b
12
package-lock.json
generated
12
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@openglobus/og",
|
||||
"version": "0.27.7",
|
||||
"version": "0.27.10",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@openglobus/og",
|
||||
"version": "0.27.7",
|
||||
"version": "0.27.10",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
@ -28,7 +28,7 @@
|
||||
"npm-run-all": "^4.1.5",
|
||||
"terser": "^5.39.0",
|
||||
"typescript": "^5.8.3",
|
||||
"vite": "^6.3.4",
|
||||
"vite": "^6.3.6",
|
||||
"vite-plugin-glsl": "^1.4.1",
|
||||
"vite-plugin-static-copy": "^2.3.1",
|
||||
"vite-tsconfig-paths": "^5.1.4",
|
||||
@ -9769,9 +9769,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "6.3.4",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.3.4.tgz",
|
||||
"integrity": "sha512-BiReIiMS2fyFqbqNT/Qqt4CVITDU9M9vE+DKcVAsB+ZV0wvTKd+3hMbkpxz1b+NmEDMegpVbisKiAZOnvO92Sw==",
|
||||
"version": "6.3.6",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.3.6.tgz",
|
||||
"integrity": "sha512-0msEVHJEScQbhkbVTb/4iHZdJ6SXp/AvxL2sjwYQFfBqleHtnCqv1J3sa9zbWz/6kW1m9Tfzn92vW+kZ1WV6QA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openglobus/og",
|
||||
"version": "0.27.7",
|
||||
"version": "0.27.12",
|
||||
"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.",
|
||||
"main": "lib/og.es.js",
|
||||
"types": "lib/index.d.ts",
|
||||
@ -63,7 +63,7 @@
|
||||
"npm-run-all": "^4.1.5",
|
||||
"terser": "^5.39.0",
|
||||
"typescript": "^5.8.3",
|
||||
"vite": "^6.3.4",
|
||||
"vite": "^6.3.6",
|
||||
"vite-plugin-glsl": "^1.4.1",
|
||||
"vite-plugin-static-copy": "^2.3.1",
|
||||
"vite-tsconfig-paths": "^5.1.4",
|
||||
|
||||
@ -551,10 +551,9 @@ class PlanetCamera extends Camera {
|
||||
|
||||
let eyeNorm = eye.getNormal();
|
||||
let slope = b.dot(eyeNorm);
|
||||
|
||||
if (u.dot(eyeNorm) <= 0) return;
|
||||
if (minSlope) {
|
||||
let dSlope = slope - this.slope;
|
||||
|
||||
if (slope < minSlope && dSlope < 0) return;
|
||||
|
||||
if (
|
||||
|
||||
@ -123,6 +123,21 @@ export class SimpleNavigation extends Control {
|
||||
this.renderer.handler.canvas!.classList.add("ogGrabbingPoiner");
|
||||
this._grabbedPoint = this.renderer.getCartesianFromPixel(e);
|
||||
this._grabbedScreenPoint.set(e.nx, e.ny);
|
||||
|
||||
// let depth = this.renderer.getDepthMinDistance();
|
||||
// console.log(depth);
|
||||
|
||||
if (!this._grabbedPoint) {
|
||||
let cam = this.renderer.activeCamera;
|
||||
let p0 = new Vec3(),
|
||||
p1 = new Vec3(1, 0, 0),
|
||||
p2 = new Vec3(0, 0, 1);
|
||||
let px = new Vec3();
|
||||
if (new Ray(cam.eye, e.direction).hitPlaneRes(Plane.fromPoints(p0, p1, p2), px) === Ray.INSIDE) {
|
||||
this._grabbedPoint = px;
|
||||
}
|
||||
}
|
||||
|
||||
if (this._grabbedPoint) {
|
||||
this._eye0.copy(this.renderer.activeCamera.eye);
|
||||
}
|
||||
|
||||
@ -165,7 +165,6 @@ export class TouchNavigation extends Control {
|
||||
protected onTouchStart(e: ITouchState) {
|
||||
const handler = this.renderer!.handler;
|
||||
this._touching = true;
|
||||
|
||||
if (e.sys!.touches.length === 2) {
|
||||
const t0 = this.touches[0];
|
||||
const t1 = this.touches[1];
|
||||
@ -303,7 +302,8 @@ export class TouchNavigation extends Control {
|
||||
|
||||
const zoomCur = t0.vec.sub(t1.vec);
|
||||
const zoomPrev = t0.vecPrev.sub(t1.vecPrev);
|
||||
const scale = zoomCur.length() / zoomPrev.length();
|
||||
let scale = zoomCur.length() / zoomPrev.length();
|
||||
scale = scale > 1.08 ? 1.08 : scale < 0.92 ? 0.92 : scale;
|
||||
|
||||
let d = distanceToPointOnEarth * -(1 - scale);
|
||||
cam.eye.addA(cam.getForward().scale(d));
|
||||
@ -315,7 +315,7 @@ export class TouchNavigation extends Control {
|
||||
var l = 0.5 / distanceToPointOnEarth * cam._lonLat.height * math.RADIANS;
|
||||
if (l > 0.003) l = 0.003;
|
||||
cam.rotateHorizontal(l * -panOffset.x, false, this.pointOnEarth, this.earthUp!);
|
||||
cam.rotateVertical(l * -panOffset.y, this.pointOnEarth);
|
||||
cam.rotateVertical(l * -panOffset.y, this.pointOnEarth, 0.1);
|
||||
|
||||
cam.checkTerrainCollision();
|
||||
cam.update();
|
||||
@ -410,8 +410,11 @@ export class TouchNavigation extends Control {
|
||||
cam.update();
|
||||
this.events.dispatch(this.events.inertiamove, this);
|
||||
}
|
||||
this.setLock(cam.eye.distance(prevEye) / cam.getAltitude() > 0.01);
|
||||
}
|
||||
|
||||
if (cam.eye.distance(prevEye) / cam.getAltitude() > 0.01) {
|
||||
private setLock(lock: boolean): void {
|
||||
if (lock) {
|
||||
this.planet!.layerLock.lock(this._keyLock);
|
||||
this.planet!.terrainLock.lock(this._keyLock);
|
||||
this.planet!._normalMapCreator.lock(this._keyLock);
|
||||
|
||||
13
src/index.ts
13
src/index.ts
@ -45,12 +45,13 @@ import {
|
||||
import {Renderer} from './renderer/Renderer';
|
||||
import {LightSource} from './light/LightSource';
|
||||
import {Clock} from './Clock';
|
||||
import {Events} from './Events';
|
||||
import {Events, type EventsHandler, createEvents} from './Events';
|
||||
import {Extent} from './Extent';
|
||||
import {LonLat} from './LonLat';
|
||||
import {RenderNode} from './scene/RenderNode';
|
||||
import {Planet} from './scene/Planet';
|
||||
import {Popup} from './Popup';
|
||||
import {Loader, type IResponse} from './utils/Loader';
|
||||
|
||||
import {
|
||||
EarthQuadTreeStrategy,
|
||||
@ -86,9 +87,9 @@ import {
|
||||
} from './terrain/index';
|
||||
|
||||
import {MoveAxisEntity} from "./control/geoObjectEditor/MoveAxisEntity";
|
||||
import { Gltf } from './utils/gltf/gltfParser';
|
||||
import { Easing } from './utils/easing';
|
||||
import type { EasingFunction } from './utils/easing';
|
||||
import {Gltf} from './utils/gltf/gltfParser';
|
||||
import {Easing} from './utils/easing';
|
||||
import type {EasingFunction} from './utils/easing';
|
||||
|
||||
export {
|
||||
bv,
|
||||
@ -127,6 +128,8 @@ export {
|
||||
Renderer,
|
||||
Clock,
|
||||
Events,
|
||||
EventsHandler,
|
||||
createEvents,
|
||||
Extent,
|
||||
LonLat,
|
||||
RenderNode,
|
||||
@ -149,4 +152,6 @@ export {
|
||||
Object3d,
|
||||
Gltf,
|
||||
MoveAxisEntity,
|
||||
Loader,
|
||||
IResponse
|
||||
};
|
||||
@ -1060,14 +1060,14 @@ class Handler {
|
||||
* @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
|
||||
* @return {WebGLBufferExt} -
|
||||
*/
|
||||
public createArrayBuffer(array: TypedArray, itemSize: number, numItems: number, usage?: number): WebGLBufferExt {
|
||||
public createArrayBuffer(array: TypedArray, itemSize: number, numItems?: number, usage?: number): WebGLBufferExt {
|
||||
let gl = this.gl!;
|
||||
let buffer: WebGLBufferExt = gl.createBuffer() as WebGLBufferExt;
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, array, usage || gl.STATIC_DRAW);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, null!);
|
||||
buffer.itemSize = itemSize;
|
||||
buffer.numItems = numItems;
|
||||
buffer.numItems = numItems || array.length / itemSize;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,18 @@
|
||||
import { Framebuffer } from "./Framebuffer";
|
||||
import { Handler } from "./Handler";
|
||||
import { Multisample } from "./Multisample";
|
||||
import { Program } from "./Program";
|
||||
import { types } from "./types";
|
||||
import {Framebuffer} from "./Framebuffer";
|
||||
import {Handler} from "./Handler";
|
||||
import type {WebGLContextExt, WebGLBufferExt, WebGLTextureExt, ImageSource} from "./Handler";
|
||||
import {Multisample} from "./Multisample";
|
||||
import {Program} from "./Program";
|
||||
import {types} from "./types";
|
||||
|
||||
export {
|
||||
Framebuffer,
|
||||
Handler,
|
||||
Multisample,
|
||||
types,
|
||||
Program
|
||||
Program,
|
||||
WebGLContextExt,
|
||||
WebGLBufferExt,
|
||||
WebGLTextureExt,
|
||||
ImageSource
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user