@terra.gl/core 0.0.1-alpha.44 → 0.0.1-alpha.45
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.d.ts +6 -0
- package/dist/index.js +37 -35
- package/dist/index.umd.cjs +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5614,6 +5614,8 @@ declare class Map extends Map_base {
|
|
|
5614
5614
|
private _createCamera;
|
|
5615
5615
|
/**
|
|
5616
5616
|
* 创建地图控制器
|
|
5617
|
+
* @param minDistance 最小缩放距离
|
|
5618
|
+
* @param maxDistance 最大缩放距离
|
|
5617
5619
|
* @returns 控制器对象
|
|
5618
5620
|
*/
|
|
5619
5621
|
private _createControls;
|
|
@@ -5827,6 +5829,10 @@ declare class Map extends Map_base {
|
|
|
5827
5829
|
/** 触发辉光的亮度阈值,对应 UnrealBloomPass 的 threshold */
|
|
5828
5830
|
threshold?: number;
|
|
5829
5831
|
};
|
|
5832
|
+
/** 控制器最小缩放距离(相机能靠多近),默认为 100 */
|
|
5833
|
+
minDistance?: number;
|
|
5834
|
+
/** 控制器最大缩放距离(相机能拉多远),默认为 60000 */
|
|
5835
|
+
maxDistance?: number;
|
|
5830
5836
|
};
|
|
5831
5837
|
|
|
5832
5838
|
export declare function waitFor(condition: boolean, delay?: number): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as pt from "three";
|
|
2
2
|
import { REVISION as qd, TrianglesDrawMode as k_, TriangleFanDrawMode as Kl, TriangleStripDrawMode as ef, Mesh as Ie, Vector3 as O, Color as ce, FrontSide as jo, Plane as tf, Matrix4 as Me, Vector4 as yn, PerspectiveCamera as jr, WebGLRenderTarget as xi, UniformsUtils as $r, UniformsLib as No, ShaderMaterial as Zn, MOUSE as cr, TOUCH as ur, Spherical as Bh, Quaternion as fn, OrthographicCamera as Ti, Vector2 as de, Ray as U_, PlaneGeometry as Jr, HalfFloatType as Ur, AdditiveBlending as oc, MeshBasicMaterial as pn, RGBAFormat as nf, LinearFilter as vr, NoBlending as N_, Clock as Jo, Loader as ac, LoaderUtils as Si, FileLoader as wr, MeshPhysicalMaterial as Gn, SpotLight as rf, PointLight as kl, DirectionalLight as Yo, InstancedMesh as lc, InstancedBufferAttribute as Ul, Object3D as mn, TextureLoader as Qo, ImageBitmapLoader as Y_, BufferAttribute as xt, InterleavedBuffer as H_, InterleavedBufferAttribute as Nr, LinearMipmapLinearFilter as bs, NearestMipmapLinearFilter as B_, LinearMipmapNearestFilter as j_, NearestMipmapNearestFilter as J_, NearestFilter as sf, RepeatWrapping as vn, MirroredRepeatWrapping as Q_, ClampToEdgeWrapping as Nl, PointsMaterial as $o, Material as yl, LineBasicMaterial as of, MeshStandardMaterial as xs, DoubleSide as Wi, PropertyBinding as ws, BufferGeometry as en, SkinnedMesh as af, LineSegments as $_, Line as lf, LineLoop as q_, Points as Gi, Group as gn, MathUtils as yt, Skeleton as cf, AnimationClip as uf, Bone as Yl, InterpolateDiscrete as eb, InterpolateLinear as hf, Texture as Zi, VectorKeyframeTrack as Hl, NumberKeyframeTrack as Bl, QuaternionKeyframeTrack as jl, Interpolant as tb, Box3 as qr, Sphere as cc, Curve as nb, MeshPhongMaterial as gs, MeshLambertMaterial as df, EquirectangularReflectionMapping as rb, AmbientLight as ff, Float32BufferAttribute as hr, Uint16BufferAttribute as ib, Matrix3 as sb, Euler as us, DataTextureLoader as ob, FloatType as Ko, DataUtils as _o, InstancedBufferGeometry as pf, InstancedInterleavedBuffer as Jl, WireframeGeometry as ab, Line3 as lb, EventDispatcher as mf, Scene as cb, FogExp2 as jh, CubeTextureLoader as ub, WebGLRenderer as hb, PCFSoftShadowMap as db, ACESFilmicToneMapping as fb, SRGBColorSpace as qo, CameraHelper as pb, CubicBezierCurve3 as mb, Frustum as gb, Raycaster as uc, CanvasTexture as Ts, SpriteMaterial as Ss, Sprite as ei, DynamicDrawUsage as Jh, NormalBlending as gf, CurvePath as yf, LineCurve3 as Li, QuadraticBezierCurve3 as vf, TubeGeometry as yb, BackSide as vb, Shape as wb, ShapeGeometry as _b, CylinderGeometry as bb, AnimationMixer as xb, LoopRepeat as Tb, LoopOnce as Sb, LoadingManager as Lb, Box2 as Mb, ImageLoader as wf } from "three";
|
|
3
|
-
const Pb = "0.0.1-alpha.
|
|
3
|
+
const Pb = "0.0.1-alpha.45", vl = {
|
|
4
4
|
name: "Criska"
|
|
5
5
|
};
|
|
6
6
|
var ys = function() {
|
|
@@ -6199,33 +6199,33 @@ class P1 extends mf {
|
|
|
6199
6199
|
* @param options 配置选项
|
|
6200
6200
|
*/
|
|
6201
6201
|
constructor(e, t = {}) {
|
|
6202
|
-
super(), Fe(this, "scene"), Fe(this, "renderer"), Fe(this, "camera"), Fe(this, "controls"), Fe(this, "ambLight"), Fe(this, "dirLight"), Fe(this, "auxDirLight"), Fe(this, "clouds", null), Fe(this, "container"), Fe(this, "_clock", new Jo()), Fe(this, "stats"), Fe(this, "_animationCallbacks", /* @__PURE__ */ new Set()), Fe(this, "_fogFactor", 1), Fe(this, "_sceneSize", 5e4 * 2), Fe(this, "gorund"), Fe(this, "map"), Fe(this, "centerPostion"), Fe(this, "_isInteracting", !1), Fe(this, "debug", !1), Fe(this, "flyTween", null), Fe(this, "composer"), Fe(this, "renderPass"), Fe(this, "bloomPass"), Fe(this, "calculateCameraPosition", (
|
|
6203
|
-
const
|
|
6202
|
+
super(), Fe(this, "scene"), Fe(this, "renderer"), Fe(this, "camera"), Fe(this, "controls"), Fe(this, "ambLight"), Fe(this, "dirLight"), Fe(this, "auxDirLight"), Fe(this, "clouds", null), Fe(this, "container"), Fe(this, "_clock", new Jo()), Fe(this, "stats"), Fe(this, "_animationCallbacks", /* @__PURE__ */ new Set()), Fe(this, "_fogFactor", 1), Fe(this, "_sceneSize", 5e4 * 2), Fe(this, "gorund"), Fe(this, "map"), Fe(this, "centerPostion"), Fe(this, "_isInteracting", !1), Fe(this, "debug", !1), Fe(this, "flyTween", null), Fe(this, "composer"), Fe(this, "renderPass"), Fe(this, "bloomPass"), Fe(this, "calculateCameraPosition", (f, g, y, w) => {
|
|
6203
|
+
const _ = new O(
|
|
6204
6204
|
0,
|
|
6205
6205
|
// X分量
|
|
6206
|
-
|
|
6206
|
+
g * Math.cos(y),
|
|
6207
6207
|
// Y分量
|
|
6208
|
-
|
|
6208
|
+
g * Math.sin(y)
|
|
6209
6209
|
// Z分量 <-- 这里改成正号
|
|
6210
6210
|
);
|
|
6211
|
-
return
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6211
|
+
return _.applyAxisAngle(new O(0, 1, 0), w), new O(
|
|
6212
|
+
f.x + _.x,
|
|
6213
|
+
f.y + _.y,
|
|
6214
|
+
f.z + _.z
|
|
6215
6215
|
);
|
|
6216
6216
|
});
|
|
6217
|
-
const { antialias: n = !1, stencil: r = !0, logarithmicDepthBuffer: o = !0, skybox: l, map: c, bloom: u } = t;
|
|
6218
|
-
if (this.map = c, this.centerPostion = this.map.geo2world(new O(this.map.center[0], this.map.center[1], 0)), this.renderer = this._createRenderer(n, r, o), this.scene = this._createScene(l), this.camera = this._createCamera(), e && this.addTo(e), this.controls = this._createControls(), this.ambLight = this._createAmbLight(), this.scene.add(this.ambLight), this.dirLight = this._createDirLight(), this.scene.add(this.dirLight), this.scene.add(this.dirLight.target), this.auxDirLight = this._createAuxDirLight(), this.gorund = this._createGorund(), this.scene.add(this.gorund), u && u.enabled) {
|
|
6219
|
-
const
|
|
6217
|
+
const { antialias: n = !1, stencil: r = !0, logarithmicDepthBuffer: o = !0, skybox: l, map: c, bloom: u, minDistance: d, maxDistance: p } = t;
|
|
6218
|
+
if (this.map = c, this.centerPostion = this.map.geo2world(new O(this.map.center[0], this.map.center[1], 0)), this.renderer = this._createRenderer(n, r, o), this.scene = this._createScene(l), this.camera = this._createCamera(), e && this.addTo(e), this.controls = this._createControls(d, p), this.ambLight = this._createAmbLight(), this.scene.add(this.ambLight), this.dirLight = this._createDirLight(), this.scene.add(this.dirLight), this.scene.add(this.dirLight.target), this.auxDirLight = this._createAuxDirLight(), this.gorund = this._createGorund(), this.scene.add(this.gorund), u && u.enabled) {
|
|
6219
|
+
const f = this.renderer.getPixelRatio(), g = this.container ? this.width : window.innerWidth, y = this.container ? this.height : window.innerHeight, w = g * f, _ = y * f, b = new xi(w, _, {
|
|
6220
6220
|
format: nf
|
|
6221
6221
|
});
|
|
6222
|
-
|
|
6223
|
-
const
|
|
6222
|
+
b.samples = 4, this.composer = new hx(this.renderer, b), this.renderPass = new px(this.scene, this.camera), this.composer.addPass(this.renderPass);
|
|
6223
|
+
const S = u?.strength ?? 1.5, x = u?.radius ?? 1, M = u?.threshold ?? 0.7;
|
|
6224
6224
|
this.bloomPass = new sx(
|
|
6225
|
-
new de(
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6225
|
+
new de(w, _),
|
|
6226
|
+
S,
|
|
6227
|
+
x,
|
|
6228
|
+
M
|
|
6229
6229
|
), this.composer.addPass(this.bloomPass);
|
|
6230
6230
|
}
|
|
6231
6231
|
this.renderer.setAnimationLoop(this.animate.bind(this)), this.debug = t.debug || !1, this.flyTween = null, this.debug && (this.stats = new ys(), document.body.appendChild(this.stats.dom));
|
|
@@ -6379,37 +6379,39 @@ class P1 extends mf {
|
|
|
6379
6379
|
}
|
|
6380
6380
|
/**
|
|
6381
6381
|
* 创建地图控制器
|
|
6382
|
+
* @param minDistance 最小缩放距离
|
|
6383
|
+
* @param maxDistance 最大缩放距离
|
|
6382
6384
|
* @returns 控制器对象
|
|
6383
6385
|
*/
|
|
6384
|
-
_createControls() {
|
|
6385
|
-
const
|
|
6386
|
-
return
|
|
6387
|
-
const
|
|
6388
|
-
|
|
6389
|
-
const
|
|
6390
|
-
|
|
6391
|
-
const
|
|
6392
|
-
|
|
6386
|
+
_createControls(e, t) {
|
|
6387
|
+
const n = new Qb(this.camera, this.renderer.domElement), r = Math.PI / 2.1;
|
|
6388
|
+
return n.screenSpacePanning = !1, n.minDistance = e ?? 0.1, n.maxDistance = t ?? 6e4, n.maxPolarAngle = r, n.enableDamping = !0, n.dampingFactor = 0.08, n.keyPanSpeed = 1, n.listenToKeyEvents(this.renderer.domElement), n.addEventListener("change", () => {
|
|
6389
|
+
const o = Math.max(n.getPolarAngle(), 0.1), l = Math.max(n.getDistance(), 100);
|
|
6390
|
+
n.zoomSpeed = Math.max(Math.log(l / 1e3), 1) + 3;
|
|
6391
|
+
const c = 3e5 * 2;
|
|
6392
|
+
n.maxDistance > c * 0.95 && (n.maxDistance = c * 0.95), this.camera.far = yt.clamp(l / o * 8, 100, c), this.camera.near = yt.clamp(this.camera.far / 1e3, 1e-3, 1), this.camera.updateProjectionMatrix(), this.scene.fog instanceof jh && (this.scene.fog.density = o / (l + 5) * this.fogFactor * 0.1);
|
|
6393
|
+
const d = l > 6e4;
|
|
6394
|
+
n.minAzimuthAngle = d ? 0 : -1 / 0, n.maxAzimuthAngle = d ? 0 : 1 / 0, n.maxPolarAngle = S1(n.getDistance(), 0, 7e4, r, 0), this.map?.trigger("control-change", {
|
|
6393
6395
|
type: "control-change",
|
|
6394
|
-
control:
|
|
6396
|
+
control: n,
|
|
6395
6397
|
camera: this.camera,
|
|
6396
6398
|
target: this.map
|
|
6397
6399
|
});
|
|
6398
|
-
}),
|
|
6400
|
+
}), n.addEventListener("start", () => {
|
|
6399
6401
|
this._isInteracting = !0, this.map?.trigger("control-start", {
|
|
6400
6402
|
type: "control-start",
|
|
6401
|
-
control:
|
|
6403
|
+
control: n,
|
|
6402
6404
|
camera: this.camera,
|
|
6403
6405
|
target: this.map
|
|
6404
6406
|
});
|
|
6405
|
-
}),
|
|
6407
|
+
}), n.addEventListener("end", () => {
|
|
6406
6408
|
this._isInteracting = !1, this.map?.trigger("control-end", {
|
|
6407
6409
|
type: "control-end",
|
|
6408
|
-
control:
|
|
6410
|
+
control: n,
|
|
6409
6411
|
camera: this.camera,
|
|
6410
6412
|
target: this.map
|
|
6411
6413
|
});
|
|
6412
|
-
}),
|
|
6414
|
+
}), n;
|
|
6413
6415
|
}
|
|
6414
6416
|
/**
|
|
6415
6417
|
* 创建环境光
|
|
@@ -17219,7 +17221,7 @@ function lM(i, e) {
|
|
|
17219
17221
|
}
|
|
17220
17222
|
const cM = `{
|
|
17221
17223
|
"name": "@terra.gl/core",
|
|
17222
|
-
"version": "0.0.1-alpha.
|
|
17224
|
+
"version": "0.0.1-alpha.45",
|
|
17223
17225
|
"type": "module",
|
|
17224
17226
|
"files": [
|
|
17225
17227
|
"dist"
|
|
@@ -20376,7 +20378,7 @@ let Ei = class yp extends pc(
|
|
|
20376
20378
|
let y = g.object, w = null;
|
|
20377
20379
|
for (; y; ) {
|
|
20378
20380
|
if (y instanceof Nn) {
|
|
20379
|
-
w = y;
|
|
20381
|
+
w = y, console.log(w, "feature ------------------- ");
|
|
20380
20382
|
break;
|
|
20381
20383
|
}
|
|
20382
20384
|
y = y.parent;
|