@reall3d/reall3dviewer 0.0.2 → 0.0.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/pkg.d.ts +4 -4
- package/dist/pkg.js +987 -1002
- package/dist/pkg.umd.cjs +14 -14
- package/package.json +8 -2
- package/dist/favicon.ico +0 -0
- /package/dist/{pkg.css → style.css} +0 -0
package/dist/pkg.js
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { Vector3 as C, InstancedBufferGeometry as
|
|
2
|
-
import * as
|
|
1
|
+
import { Vector3 as C, InstancedBufferGeometry as rn, BufferAttribute as He, InstancedBufferAttribute as ca, DynamicDrawUsage as la, ShaderMaterial as _n, DoubleSide as we, NormalBlending as da, DataTexture as Ee, RGBAIntegerFormat as _e, UnsignedIntType as Ie, Mesh as te, Vector4 as ve, Vector2 as j, WebGLRenderer as es, PerspectiveCamera as ts, Object3D as In, CylinderGeometry as ei, MeshBasicMaterial as xe, PlaneGeometry as ua, Quaternion as _t, Controls as ha, MOUSE as Ae, TOUCH as Se, Spherical as ti, Ray as pa, Plane as fa, MathUtils as be, Float32BufferAttribute as ni, InstancedInterleavedBuffer as cn, InterleavedBufferAttribute as We, WireframeGeometry as ga, Box3 as Dn, Sphere as tt, ShaderLib as bt, UniformsUtils as ns, UniformsLib as xt, Line3 as ma, Matrix4 as $e, CircleGeometry as De, Group as Qt, BufferGeometry as ya, Raycaster as Aa, SphereGeometry as wa, Color as is, FrontSide as va, CatmullRomCurve3 as ii, Scene as ss, AmbientLight as as, FogExp2 as si, DirectionalLight as Sa, EventDispatcher as ba, Clock as xa } from "three";
|
|
2
|
+
import * as ai from "@gotoeasy/three-tile";
|
|
3
3
|
let A = 1;
|
|
4
|
-
const at = A++,
|
|
4
|
+
const at = A++, Pn = A++, Pe = A++, os = A++, ln = A++, dn = A++, rs = A++, Gt = A++, cs = A++, Ke = A++, V = A++, Y = A++, ls = A++, un = A++, Ce = A++, Ne = A++, Be = A++, ft = A++, ds = A++, us = A++, hs = A++, Ca = A++, ps = A++, fs = A++, Ln = A++, Ma = A++, Ta = A++, oi = A++, q = A++;
|
|
5
5
|
A++;
|
|
6
|
-
const oe = A++, ot = A++, Ye = A++, ri = A++, ci = A++, li = A++, gs = A++, ka = A++, di = A++,
|
|
6
|
+
const oe = A++, ot = A++, Ye = A++, ri = A++, ci = A++, li = A++, gs = A++, ka = A++, di = A++, Nt = A++, Xt = A++, ui = A++, hi = A++, pi = A++, nt = A++, fi = A++, rt = A++, ms = A++, gt = A++, $t = A++, Ct = A++, ys = A++, hn = A++, Ea = A++, Fn = A++, gi = A++, mi = A++, It = A++, Dt = A++, Pt = A++, Lt = A++, As = A++, Rn = A++, _ = A++, Ue = A++, ct = A++, B = A++, Ht = A++, ws = A++, _a = A++, ee = A++, pn = A++, re = A++, vs = A++, Ss = A++, bs = A++, xs = A++, fn = A++, Cs = A++, Le = A++, Ms = A++, Ts = A++, Mt = A++, Ia = A++, ks = A++, Es = A++;
|
|
7
7
|
A++;
|
|
8
|
-
const
|
|
8
|
+
const Wt = A++, Kt = A++, yi = A++, Ai = A++, gn = A++, Ft = A++, mn = A++, it = A++, ce = A++, Bn = A++, _s = A++, Da = A++, Is = A++, wi = A++, vi = A++, Pa = A++, La = A++, Tt = A++, Rt = A++, Un = A++, Ve = A++, Oe = A++, lt = A++, mt = A++, Ds = A++, N = A++, J = A++, Fa = A++, Si = A++, Bt = A++, Ut = A++, Ra = A++, On = A++, zn = A++, Me = A++, st = A++, Ze = A++, Ba = A++, Ps = A++, Ua = A++;
|
|
9
9
|
A++;
|
|
10
10
|
A++;
|
|
11
11
|
A++;
|
|
12
12
|
A++;
|
|
13
13
|
A++;
|
|
14
|
-
const Te = A++, dt = A++,
|
|
14
|
+
const Te = A++, dt = A++, kt = A++, yn = A++, Ls = A++, Fs = A++, An = A++, ke = A++, qe = A++, Rs = A++, Qn = A++, bi = A++, Oa = A++, za = A++, Hn = A++, Bs = A++, Wn = A++, Yn = A++, Vn = A++, Ot = A++, Us = A++, xi = A++, zt = A++, ye = A++, Os = A++, zs = A++;
|
|
15
15
|
A++;
|
|
16
|
-
const Je = A++, Qs = A++, Hs = A++,
|
|
16
|
+
const Je = A++, Qs = A++, Hs = A++, Gn = A++, Ws = A++, Qa = A++, Ys = A++, Ci = A++, Vs = A++, Gs = A++;
|
|
17
17
|
A++;
|
|
18
|
-
const Ns = A++, Xs = A++, X = A++,
|
|
18
|
+
const Ns = A++, Xs = A++, X = A++, wn = A++, vn = A++, Sn = A++, Ha = A++, $s = A++, Wa = A++, Ya = A++, Va = A++, Ga = A++, Na = A++, Ks = A++, Zs = A++;
|
|
19
19
|
A++;
|
|
20
20
|
A++;
|
|
21
21
|
A++;
|
|
22
22
|
A++;
|
|
23
23
|
A++;
|
|
24
|
-
class
|
|
24
|
+
class Nn {
|
|
25
25
|
constructor() {
|
|
26
26
|
this.map = /* @__PURE__ */ new Map();
|
|
27
27
|
}
|
|
28
28
|
on(e, t = null, n = !1) {
|
|
29
29
|
if (!e)
|
|
30
30
|
return console.error("Invalid event key", e), null;
|
|
31
|
-
if (!t)
|
|
32
|
-
return this.map.get(e);
|
|
31
|
+
if (!t) return this.map.get(e);
|
|
33
32
|
if (n) {
|
|
34
33
|
let a = this.map.get(e);
|
|
35
34
|
a ? typeof a == "function" ? console.error("Invalid event type", "multiFn=true", e) : a.push(t) : (a = [], this.map.set(e, a), a.push(t));
|
|
@@ -62,13 +61,13 @@ class Xn {
|
|
|
62
61
|
}
|
|
63
62
|
class Xa {
|
|
64
63
|
}
|
|
65
|
-
class
|
|
64
|
+
class $a {
|
|
66
65
|
constructor(e, t = {}) {
|
|
67
66
|
this.fileSize = 0, this.downloadSize = 0, this.status = 0, this.splatData = null, this.watermarkData = null, this.dataSplatCount = 0, this.watermarkCount = 0, this.sh12Data = [], this.sh3Data = [], this.sh12Count = 0, this.sh3Count = 0, this.rowLength = 0, this.modelSplatCount = -1, this.downloadSplatCount = 0, this.renderSplatCount = 0, this.header = null, this.dataShDegree = 0, this.minX = 1 / 0, this.maxX = -1 / 0, this.minY = 1 / 0, this.maxY = -1 / 0, this.minZ = 1 / 0, this.maxZ = -1 / 0, this.topY = 0, this.currentRadius = 0, this.textWatermarkVersion = 0, this.lastTextWatermarkVersion = 0, this.fetchLimit = 0, this.opts = { ...e }, this.meta = t, t.autoCut && (this.map = /* @__PURE__ */ new Map()), e.format || (e.url?.endsWith(".spx") ? this.opts.format = "spx" : e.url?.endsWith(".splat") ? this.opts.format = "splat" : e.url?.endsWith(".ply") ? this.opts.format = "ply" : e.url?.endsWith(".spz") ? this.opts.format = "spz" : console.error("unknow format!")), this.abortController = new AbortController();
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
var L = /* @__PURE__ */ ((i) => (i[i.FetchReady = 0] = "FetchReady", i[i.Fetching = 1] = "Fetching", i[i.FetchDone = 2] = "FetchDone", i[i.FetchAborted = 3] = "FetchAborted", i[i.FetchFailed = 4] = "FetchFailed", i[i.Invalid = 5] = "Invalid", i))(L || {});
|
|
71
|
-
const
|
|
70
|
+
const Yt = "v1.5.0-dev-map", le = navigator.userAgent.includes("Mobi"), Ka = "QWERTYUIOPLKJHGFDSAZXCVBNM1234567890qwertyuioplkjhgfdsazxcvbnm`~!@#$%^&*()-_=+\\|]}[{'\";::,<.>//? ", ze = 128, Za = 32, R = 32, ja = 20, qa = 16, js = 64 * 1024, Ja = 1024 * 1e4, eo = 10240 * 1e4, Et = 0.28209479177387814, to = 0, no = 20, Xn = 1, ut = 2, $n = 3, io = 3141592653, Kn = "AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEeBmABfQF9YAAAYAF9AX9gAX8Bf2ACf38AYAJ/fwF/AhoCA2VudgRleHBmAAADZW52Bm1lbW9yeQIAAAMGBQECAwQFByEEEV9fd2FzbV9jYWxsX2N0b3JzAAEBSAADAXcABAFEAAUKigsFAwABC3IBBH8gALwiBEH///8DcSEBAkAgBEEXdkH/AXEiAkUNACACQfAATQRAIAFBgICABHJB8QAgAmt2IQEMAQsgAkGNAUsEQEGA+AEhA0EAIQEMAQsgAkEKdEGAgAdrIQMLIAMgBEEQdkGAgAJxciABQQ12cgsyAQJ/QcGmFiEBA0AgACACai0AACABQSFscyEBIAJBAWoiAkH8AEcNAAsgASAAKAJ8RwszACAAQQhBBCABQQFGG2pBADYCACAAQQA2ABwgAP0MAAABAIwRFgCVAWwS7YEyE/0LAgwLqQkDKH8OfQR8IAEoAgRBi/AJRgR/IAEoAgAiBEEASgRAIAFBCWoiAiAEQRNsaiEIIAIgBEESbGohCSACIARBEWxqIQogAiAEQQR0aiELIAIgBEEPbGohDCACIARBDmxqIQ0gAiAEQQ1saiEOIAIgBEEMbGohDyACIARBC2xqIRAgAiAEQQpsaiERIAIgBEEJbGohEiACIARBBmxqIRMgAiAEQQNsaiEUIAEtAAghFUEAIQIDQCACIAlqLQAAIQcgAiAKai0AACEWIAIgC2otAAAhFyACIAxqLQAAIRggAiANai0AACEZIAIgDmotAAAhGiACIA9qLQAAIRsgAiAQai0AACEcIAIgEWotAAAhHSACIBJqLQAAIR4gEyACQQNsIgNqIgUtAAAhHyADIBRqIgYtAAAhICABIANqIgMtAAohISADLQAJISIgBS0AASEjIAYtAAEhJCADLQALIiXAISYgBS0AAiInwCEoIAYtAAIiBsAhKUEAIQUgFQRAIAggAkEBdGoiAy0AASIFQQh0QYD+AXEgAy0AAHIgBUEJdEGAgARxciEFCyAes0MAAIA9lEMAACDBkhAAIS8gHbNDAACAPZRDAAAgwZIQACExIByzQwAAgD2UQwAAIMGSEAAhMkMAAAAAQwAAgD8gB7NDAAAAw5JDAAAAPJQiKiAqlCAXs0MAAADDkkMAAAA8lCIrICuUIBazQwAAAMOSQwAAADyUIiwgLJSSkpMiLZEgLUMAAAAAXRshLSAAIAJBBXRqIgMgIUEIdCAiciAlQRB0ciIHQYCAgHhyIAcgJkEASBuyQwAAgDmUOAIAIAMgBTYCDCADICNBCHQgH3IgJ0EQdHIiBUGAgIB4ciAFIChBAEgbskMAAIA5lDgCCCADICRBCHQgIHIgBkEQdHIiBUGAgIB4ciAFIClBAEgbskMAAIA5lDgCBCADICsgKiAqlCAsICyUIC0gLZQgKyArlJKSkpEiLpUiKyAqIC6VIiqUIjQgLSAulSIwICwgLpUiLJQiNZK7IjggOKAgMrsiOKK2Ii0gLZREAAAAAAAA8D8gLCAslCIyICogKpQiNpK7IjogOqChIC+7IjqitiIuIC6UICsgLJQiMyAwICqUIjeTuyI7IDugIDG7IjuitiIvIC+UkpJDAACAQJQQAiAtICwgKpQiMSAwICuUIjCTuyI5IDmgIDiitiIqlCAuIDMgN5K7IjkgOaAgOqK2IiyUIC9EAAAAAAAA8D8gKyArlCIzIDaSuyI5IDmgoSA7orYiK5SSkkMAAIBAlBACQRB0cjYCECADIC1EAAAAAAAA8D8gMyAykrsiOSA5oKEgOKK2Ii2UIC4gNCA1k7siOCA4oCA6orYiLpQgLyAxIDCSuyI4IDigIDuitiIvlJKSQwAAgECUEAIgKiAqlCAsICyUICsgK5SSkkMAAIBAlBACQRB0cjYCFCADIBpBCHQgG3IgGUEQdHIgGEEYdHI2AhwgAyAqIC2UICwgLpQgKyAvlJKSQwAAgECUEAIgLSAtlCAuIC6UIC8gL5SSkkMAAIBAlBACQRB0cjYCGCACQQFqIgIgBEcNAAsLQQAFQQELCw==", Zn = "AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEpBmACf38Bf2ABfQF9YAAAYAF9AX9gAX8Bf2ANf399fX19fX19fX19fwACGgIDZW52BGV4cGYAAQNlbnYGbWVtb3J5AgAAAwcGAgMEBQAAByEEEV9fd2FzbV9jYWxsX2N0b3JzAAEBSAADAXMABQFEAAYKnhUGAwABC3IBBH8gALwiBEH///8DcSEBAkAgBEEXdkH/AXEiAkUNACACQfAATQRAIAFBgICABHJB8QAgAmt2IQEMAQsgAkGNAUsEQEGA+AEhA0EAIQEMAQsgAkEKdEGAgAdrIQMLIAMgBEEQdkGAgAJxciABQQ12cgsyAQJ/QZWjAyEBA0AgACACai0AACABQSFscyEBIAJBAWoiAkH8AEcNAAsgASAAKAJ8RwvpAwIEfAR9IAAgAUECdGoiACACOAIAIABBADYCDCAAIAQ4AgggACADOAIEIAAgCSALIAuUIAogCpQgCCAIlCAJIAmUkpKSkSIElSICIAsgBJUiA5QiCSAIIASVIgggCiAElSIElCIKkrsiDSANoCAHuyINorYiByAHlEQAAAAAAADwPyAEIASUIgsgAyADlCISkrsiDyAPoKEgBbsiD6K2IgUgBZQgAiAElCIRIAggA5QiE5O7IhAgEKAgBrsiEKK2IgYgBpSSkkMAAIBAlBACIAcgBCADlCIUIAggApQiCJO7Ig4gDqAgDaK2IgOUIAUgESATkrsiDiAOoCAPorYiBJQgBkQAAAAAAADwPyACIAKUIhEgEpK7Ig4gDqChIBCitiIClJKSQwAAgECUEAJBEHRyNgIQIAAgB0QAAAAAAADwPyARIAuSuyIOIA6goSANorYiB5QgBSAJIAqTuyINIA2gIA+itiIFlCAGIBQgCJK7Ig0gDaAgEKK2IgaUkpJDAACAQJQQAiADIAOUIAQgBJQgAiAClJKSQwAAgECUEAJBEHRyNgIUIAAgDDYCHCAAIAMgB5QgBCAFlCACIAaUkpJDAACAQJQQAiAHIAeUIAUgBZQgBiAGlJKSQwAAgECUEAJBEHRyNgIYC70BAQJ/IAFBAEoEQANAIAAgA0EDdCAAIANBBXRqIgIqAgAgAioCBCACKgIIIAIqAgwgAioCECACKgIUIAItABy4RAAAAAAAAGDAoEQAAAAAAACAP6K2IAItAB24RAAAAAAAAGDAoEQAAAAAAACAP6K2IAItAB64RAAAAAAAAGDAoEQAAAAAAACAP6K2IAItAB+4RAAAAAAAAGDAoEQAAAAAAACAP6K2IAIoAhgQBCADQQFqIgMgAUcNAAsLQQALxw4BHH8CfwJAAkACQAJAAkAgASgCBCICQQFrDgMBAgMAC0EBIAJBFEcNBBogASgCACIDQQBKBEAgAUEIaiICIANBE2xqIQUgAiADQRJsaiEGIAIgA0ERbGohCCACIANBBHRqIQkgAiADQQ9saiEKIAIgA0EObGohCyACIANBDWxqIQwgAiADQQxsaiENIAIgA0ELbGohDiACIANBCmxqIQ8gAiADQQlsaiEQIAIgA0EGbGohESACIANBA2xqIRJBACECA0AgAiAMai0AACETIAIgDWotAAAhFCACIAtqLQAAIRUgAiAKai0AACEWIAIgBWotAAAhFyACIAZqLQAAIRggAiAIai0AACEZIAIgCWotAAAhGyACIA5qLQAAIRwgAiAPai0AACEdIAAgAkEDdCABIAJBA2wiBGoiBy8ACCAHLAAKIgdB/wFxQRB0ciIaQYCAgHhyIBogB0EASBuyQwAAgDmUIAQgEmoiBy8AACAHLAACIgdB/wFxQRB0ciIaQYCAgHhyIBogB0EASBuyQwAAgDmUIAQgEWoiBC8AACAELAACIgRB/wFxQRB0ciIHQYCAgHhyIAcgBEEASBuyQwAAgDmUIAIgEGotAACzQwAAgD2UQwAAIMGSEAAgHbNDAACAPZRDAAAgwZIQACAcs0MAAIA9lEMAACDBkhAAIBu4RAAAAAAAAGDAoEQAAAAAAACAP6K2IBm4RAAAAAAAAGDAoEQAAAAAAACAP6K2IBi4RAAAAAAAAGDAoEQAAAAAAACAP6K2IBe4RAAAAAAAAGDAoEQAAAAAAACAP6K2IBQgE0EIdHIgFUEQdHIgFkEYdHIQBCACQQFqIgIgA0cNAAsLDAMLIAEoAgAiBUEASgRAA0AgASADQQlsaiICLQANIQYgAi0ADCEIIAItAAshCSACLQAKIQogAi0ACSELIAItAAghDCACLQAQIQ0gAi0ADyEOIAItAA4hAiAAIANBBHRqIgRCgICAgBA3AgggBCANQRB0QYCA4AdxIA5BFXRBgICA+AFxIAJBGnRBgICAgH5xcnI2AgQgBCAGQQF2QfwAcSAIQQR0QYAfcSAJQQl0QYDgB3EgCkEOdEGAgPgBcSALQRN0QYCAgD5xIAxBGHRBgICAQHFycnJyciACQQZ2cjYCACADQQFqIgMgBUcNAAsLDAILIAEoAgAiCEEASgRAA0AgASADQRhsaiICLQAaIQkgAi0AGSEKIAItABghCyACLQAXIQwgAi0AFiENIAItABUhDiACLQANIQ8gAi0ADCEQIAItAAshESACLQAKIRIgAi0ACSETIAItAAghFCACLQAUIQUgAi0AEyEVIAItABIhFiACLQARIRcgAi0AECEYIAItAA8hGSACLQAOIQYgACADQQR0aiIEIAItAB9BBXRBgD5xIAItAB5BCnRBgMAPcSACLQAdQQ90QYCA8ANxIAItABxBFHRBgICA/ABxIAItABsiAkEZdEGAgICAf3FycnJyQQFyNgIMIAQgFUEBdEHwA3EgFkEGdEGA/ABxIBdBC3RBgIAfcSAYQRB0QYCA4AdxIBlBFXRBgICA+AFxIAZBGnRBgICAgH5xcnJycnIgBUEEdnI2AgQgBCAPQQF2QfwAcSAQQQR0QYAfcSARQQl0QYDgB3EgEkEOdEGAgPgBcSATQRN0QYCAgD5xIBRBGHRBgICAQHFycnJyciAGQQZ2cjYCACAEIAlBAnZBPnEgCkEDdEHAD3EgC0EIdEGA8ANxIAxBDXRBgID8AHEgDUESdEGAgIAfcSAOQRd0QYCAgOAHcSAFQRx0QYCAgIB4cXJycnJyciACQQd2cjYCCCADQQFqIgMgCEcNAAsLDAELIAEoAgAiCEEASgRAA0AgASADQRVsaiICLQAaIQkgAi0AGSEKIAItABghCyACLQAXIQwgAi0AFiENIAItABUhDiACLQANIQ8gAi0ADCEQIAItAAshESACLQAKIRIgAi0ACSETIAItAAghFCACLQAUIQUgAi0AEyEVIAItABIhFiACLQARIRcgAi0AECEYIAItAA8hGSACLQAOIQYgACADQQR0aiIEIAItABxBFHRBgICA/ABxIAItABsiAkEZdEGAgICAf3FyQQFyNgIMIAQgFUEBdEHwA3EgFkEGdEGA/ABxIBdBC3RBgIAfcSAYQRB0QYCA4AdxIBlBFXRBgICA+AFxIAZBGnRBgICAgH5xcnJycnIgBUEEdnI2AgQgBCAPQQF2QfwAcSAQQQR0QYAfcSARQQl0QYDgB3EgEkEOdEGAgPgBcSATQRN0QYCAgD5xIBRBGHRBgICAQHFycnJyciAGQQZ2cjYCACAEIAlBAnZBPnEgCkEDdEHAD3EgC0EIdEGA8ANxIAxBDXRBgID8AHEgDUESdEGAgIAfcSAOQRd0QYCAgOAHcSAFQRx0QYCAgIB4cXJycnJyciACQQd2cjYCCCADQQFqIgMgCEcNAAsLC0EACws=";
|
|
72
71
|
async function so(i) {
|
|
73
72
|
const e = new Uint32Array(i.buffer), t = new Float32Array(i.buffer), n = new Xa();
|
|
74
73
|
n.Fixed = String.fromCharCode(i[0]) + String.fromCharCode(i[1]) + String.fromCharCode(i[2]), n.Version = i[3], n.SplatCount = e[1], n.MinX = t[2], n.MaxX = t[3], n.MinY = t[4], n.MaxY = t[5], n.MinZ = t[6], n.MaxZ = t[7], n.MinTopY = t[8], n.MaxTopY = t[9], n.CreateDate = e[10], n.CreaterId = e[11], n.ExclusiveId = e[12], n.ShDegree = i[52], n.Flag1 = i[53], n.Flag2 = i[54], n.Flag3 = i[55], n.Reserve1 = e[14], n.Reserve2 = e[15];
|
|
@@ -77,24 +76,24 @@ async function so(i) {
|
|
|
77
76
|
a += String.fromCharCode(i[h]);
|
|
78
77
|
if (n.Comment = a.trim(), n.HashCheck = !0, n.Fixed !== "spx" && n.Version !== 1)
|
|
79
78
|
return null;
|
|
80
|
-
const o = n.CreaterId == 1202056903 ?
|
|
79
|
+
const o = n.CreaterId == 1202056903 ? Zn : Kn, s = WebAssembly.compile(Uint8Array.from(atob(o), (h) => h.charCodeAt(0)).buffer), r = new WebAssembly.Memory({ initial: 1, maximum: 1 }), u = (await WebAssembly.instantiate(await s, { env: { memory: r, expf: Vt } })).exports.H;
|
|
81
80
|
return new Uint8Array(r.buffer).set(i, 0), u(0) && (n.HashCheck = !1), n;
|
|
82
81
|
}
|
|
83
82
|
async function fe(i) {
|
|
84
|
-
const e = new Uint32Array(i.slice(0, 8).buffer), t = e[0], n = e[1], a =
|
|
85
|
-
return g.set(i,
|
|
83
|
+
const e = new Uint32Array(i.slice(0, 8).buffer), t = e[0], n = e[1], a = Xn == n, o = ut == n, s = $n == n, r = a || o || s, c = !r, u = n == 20 || r ? Zn : Kn, d = t * (r ? qa : R), l = WebAssembly.compile(Uint8Array.from(atob(u), (x) => x.charCodeAt(0)).buffer), h = Math.floor((d + i.byteLength) / js) + 2, f = new WebAssembly.Memory({ initial: h, maximum: h }), y = (await WebAssembly.instantiate(await l, { env: { memory: f, expf: Vt } })).exports.D, g = new Uint8Array(f.buffer);
|
|
84
|
+
return g.set(i, d), y(0, d) ? { splatCount: t, blockFormat: n, success: !1 } : { splatCount: t, blockFormat: n, success: !0, datas: g.slice(0, d), isSplat: c, isSh: r, isSh1: a, isSh2: o, isSh3: s };
|
|
86
85
|
}
|
|
87
|
-
async function
|
|
88
|
-
const t = WebAssembly.compile(Uint8Array.from(atob(
|
|
89
|
-
r.set(i.slice(0, e *
|
|
86
|
+
async function bn(i, e) {
|
|
87
|
+
const t = WebAssembly.compile(Uint8Array.from(atob(Zn), (u) => u.charCodeAt(0)).buffer), n = Math.floor(e * R / js) + 2, a = new WebAssembly.Memory({ initial: n, maximum: n }), s = (await WebAssembly.instantiate(await t, { env: { memory: a, expf: Vt } })).exports.s, r = new Uint8Array(a.buffer);
|
|
88
|
+
r.set(i.slice(0, e * R), 0);
|
|
90
89
|
const c = s(0, e);
|
|
91
|
-
return c ? (console.error("splat data parser failed:", c), new Uint8Array(0)) : r.slice(0, e *
|
|
90
|
+
return c ? (console.error("splat data parser failed:", c), new Uint8Array(0)) : r.slice(0, e * R);
|
|
92
91
|
}
|
|
93
92
|
async function ao(i, e, t = !0, n = !0) {
|
|
94
|
-
const a = WebAssembly.compile(Uint8Array.from(atob(
|
|
95
|
-
return u[0] = i, t ? u[1] =
|
|
93
|
+
const a = WebAssembly.compile(Uint8Array.from(atob(Kn), (l) => l.charCodeAt(0)).buffer), o = new WebAssembly.Memory({ initial: 1, maximum: 1 }), r = (await WebAssembly.instantiate(await a, { env: { memory: o, expf: Vt } })).exports.w, c = new Uint8Array(o.buffer), u = new Float32Array(c.buffer), d = n ? -1 : 1;
|
|
94
|
+
return u[0] = i, t ? u[1] = d * e : u[2] = d * e, r(0, t ? 1 : 0), c.slice(0, R);
|
|
96
95
|
}
|
|
97
|
-
function
|
|
96
|
+
function Vt(i) {
|
|
98
97
|
return Math.exp(i);
|
|
99
98
|
}
|
|
100
99
|
const Qe = le ? 20480 : 51200;
|
|
@@ -115,12 +114,11 @@ async function oo(i) {
|
|
|
115
114
|
return;
|
|
116
115
|
}
|
|
117
116
|
i.modelSplatCount = c, i.downloadSplatCount = 0, i.splatData = new Uint8Array(Math.min(i.modelSplatCount, i.fetchLimit) * 32), i.watermarkData = new Uint8Array(0);
|
|
118
|
-
let u = new Uint8Array(32),
|
|
117
|
+
let u = new Uint8Array(32), d = 0;
|
|
119
118
|
for (; ; ) {
|
|
120
|
-
let { done:
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
l + h.byteLength < i.rowLength ? (u.set(h, l), l += h.byteLength, e += h.length, i.downloadSize = e) : (l = await t(i, l, u, h), l && u.set(h.slice(h.byteLength - l), 0)), i.downloadSplatCount >= i.fetchLimit && i.abortController.abort();
|
|
119
|
+
let { done: l, value: h } = await s.read();
|
|
120
|
+
if (l) break;
|
|
121
|
+
d + h.byteLength < i.rowLength ? (u.set(h, d), d += h.byteLength, e += h.length, i.downloadSize = e) : (d = await t(i, d, u, h), d && u.set(h.slice(h.byteLength - d), 0)), i.downloadSplatCount >= i.fetchLimit && i.abortController.abort();
|
|
124
122
|
}
|
|
125
123
|
} catch (n) {
|
|
126
124
|
n.name === "AbortError" ? (console.log("Fetch Abort", i.opts.url), i.status === L.Fetching && (i.status = L.FetchAborted)) : (console.error(n), i.status === L.Fetching && (i.status = L.FetchFailed));
|
|
@@ -129,25 +127,25 @@ async function oo(i) {
|
|
|
129
127
|
}
|
|
130
128
|
async function t(n, a, o, s) {
|
|
131
129
|
return new Promise(async (r) => {
|
|
132
|
-
let c = (a + s.byteLength) / n.rowLength | 0, u = (a + s.byteLength) % n.rowLength,
|
|
133
|
-
a ? (
|
|
134
|
-
const
|
|
130
|
+
let c = (a + s.byteLength) / n.rowLength | 0, u = (a + s.byteLength) % n.rowLength, d;
|
|
131
|
+
a ? (d = new Uint8Array(c * n.rowLength), d.set(o.slice(0, a), 0), d.set(s.slice(0, s.byteLength - u), a)) : d = s.slice(0, c * n.rowLength), n.downloadSplatCount + c > n.fetchLimit && (c = n.fetchLimit - n.downloadSplatCount, u = 0);
|
|
132
|
+
const l = async () => {
|
|
135
133
|
if (c > Qe) {
|
|
136
|
-
const h = await
|
|
137
|
-
Mi(n, h), n.downloadSplatCount += Qe, e += Qe * n.rowLength, n.downloadSize = e, c -= Qe,
|
|
134
|
+
const h = await bn(d, Qe);
|
|
135
|
+
Mi(n, h), n.downloadSplatCount += Qe, e += Qe * n.rowLength, n.downloadSize = e, c -= Qe, d = d.slice(Qe * n.rowLength), setTimeout(l);
|
|
138
136
|
} else {
|
|
139
|
-
const h = await
|
|
137
|
+
const h = await bn(d, c);
|
|
140
138
|
Mi(n, h), n.downloadSplatCount += c, e += c * n.rowLength, n.downloadSize = e, r(u);
|
|
141
139
|
}
|
|
142
140
|
};
|
|
143
|
-
await
|
|
141
|
+
await l();
|
|
144
142
|
});
|
|
145
143
|
}
|
|
146
144
|
}
|
|
147
145
|
function Mi(i, e) {
|
|
148
|
-
let t = e.byteLength /
|
|
146
|
+
let t = e.byteLength / R;
|
|
149
147
|
const n = Math.min(i.fetchLimit, i.modelSplatCount);
|
|
150
|
-
i.dataSplatCount + t > n ? (t = n - i.dataSplatCount, i.splatData.set(e.slice(0, t *
|
|
148
|
+
i.dataSplatCount + t > n ? (t = n - i.dataSplatCount, i.splatData.set(e.slice(0, t * R), i.dataSplatCount * R)) : i.splatData.set(e, i.dataSplatCount * R);
|
|
151
149
|
const a = new Float32Array(e.buffer);
|
|
152
150
|
for (let s = 0, r = 0, c = 0, u = 0; s < t; s++)
|
|
153
151
|
r = a[s * 8], c = a[s * 8 + 1], u = a[s * 8 + 2], i.minX = Math.min(i.minX, r), i.maxX = Math.max(i.maxX, r), i.minY = Math.min(i.minY, c), i.maxY = Math.max(i.maxY, c), i.minZ = Math.min(i.minZ, u), i.maxZ = Math.max(i.maxZ, u);
|
|
@@ -155,10 +153,10 @@ function Mi(i, e) {
|
|
|
155
153
|
const o = i.header?.MinTopY || 0;
|
|
156
154
|
i.currentRadius = Math.sqrt(i.maxX * i.maxX + o * o + i.maxZ * i.maxZ), i.aabbCenter = new C((i.minX + i.maxX) / 2, (i.minY + i.maxY) / 2, (i.minZ + i.maxZ) / 2);
|
|
157
155
|
}
|
|
158
|
-
function
|
|
156
|
+
function jn(i) {
|
|
159
157
|
let e = !1;
|
|
160
158
|
const t = (p, y, g) => i.on(p, y, g), n = (p, ...y) => i.fire(p, ...y), a = !n(_).renderer;
|
|
161
|
-
t(re, () => n(_).debugMode), t(
|
|
159
|
+
t(re, () => n(_).debugMode), t(Rn, () => e = !0);
|
|
162
160
|
let o = 0;
|
|
163
161
|
(function p() {
|
|
164
162
|
o++, !e && requestAnimationFrame(p);
|
|
@@ -167,7 +165,7 @@ function qn(i) {
|
|
|
167
165
|
e || (g > 0 ? !(o % g) && p(o) : p(o), y && y() && requestAnimationFrame(m));
|
|
168
166
|
};
|
|
169
167
|
m();
|
|
170
|
-
}), t(
|
|
168
|
+
}), t(Pn, (p, y = null, g = 20) => {
|
|
171
169
|
const m = () => {
|
|
172
170
|
e || (p(), y && y() && setTimeout(m, g));
|
|
173
171
|
};
|
|
@@ -183,7 +181,7 @@ function qn(i) {
|
|
|
183
181
|
y && (y.style.width = "0%");
|
|
184
182
|
}
|
|
185
183
|
})(), (async () => document.querySelector("#gsviewer .logo")?.classList.add("loading"))()) : parent?.onProgress && parent.onProgress(1e-3, "0.001%");
|
|
186
|
-
}), t(
|
|
184
|
+
}), t(Mt, (p) => {
|
|
187
185
|
p && (r = p), s = !1, p !== void 0 && ((async () => {
|
|
188
186
|
const y = document.querySelector("#gsviewer #progressBarWrap");
|
|
189
187
|
y && (y.style.display = "none");
|
|
@@ -196,52 +194,53 @@ function qn(i) {
|
|
|
196
194
|
}), t(Ia, () => s), t(ks, (p) => {
|
|
197
195
|
c = p;
|
|
198
196
|
}), t(Es, () => !s && r && c >= r), t(Ue, () => {
|
|
199
|
-
const y = n(
|
|
197
|
+
const y = n(Ke).parentElement.getBoundingClientRect();
|
|
200
198
|
return { width: y.width, height: y.height, left: y.left, top: y.top };
|
|
201
199
|
}), t(Le, (p) => {
|
|
202
200
|
let y = p.x.toFixed(3).split("."), g = p.y.toFixed(3).split("."), m = p.z.toFixed(3).split(".");
|
|
203
201
|
return (y[1] === "000" || y[1] === "00000") && (y[1] = "0"), (g[1] === "000" || g[1] === "00000") && (g[1] = "0"), (m[1] === "000" || m[1] === "00000") && (m[1] = "0"), `${y.join(".")}, ${g.join(".")}, ${m.join(".")}`;
|
|
204
202
|
}), t(Ma, (p) => btoa(p)), t(Ta, (p) => atob(p));
|
|
205
203
|
const u = 1e-3;
|
|
206
|
-
let
|
|
204
|
+
let d = new C(), l = new C(), h = 0;
|
|
207
205
|
t(_a, () => {
|
|
208
206
|
const p = n(V), y = p.fov, g = p.position.clone(), m = p.getWorldDirection(new C());
|
|
209
|
-
return Math.abs(h - y) < u && Math.abs(g.x -
|
|
207
|
+
return Math.abs(h - y) < u && Math.abs(g.x - d.x) < u && Math.abs(g.y - d.y) < u && Math.abs(g.z - d.z) < u && Math.abs(m.x - l.x) < u && Math.abs(m.y - l.y) < u && Math.abs(m.z - l.z) < u ? !1 : (h = y, d = g, l = m, !0);
|
|
210
208
|
}), t(ke, (p) => {
|
|
211
|
-
if (!p)
|
|
212
|
-
return;
|
|
209
|
+
if (!p) return;
|
|
213
210
|
const y = [];
|
|
214
211
|
p.traverse((g) => y.push(g)), y.forEach((g) => {
|
|
215
212
|
g.dispose ? g.dispose() : (g.geometry?.dispose?.(), g.material && g.material instanceof Array ? g.material.forEach((m) => m?.dispose?.()) : g.material?.dispose?.());
|
|
216
213
|
}), p.clear();
|
|
217
|
-
}), t(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
214
|
+
}), t(
|
|
215
|
+
oe,
|
|
216
|
+
async ({
|
|
217
|
+
renderSplatCount: p,
|
|
218
|
+
visibleSplatCount: y,
|
|
219
|
+
modelSplatCount: g,
|
|
220
|
+
fps: m,
|
|
221
|
+
realFps: x,
|
|
222
|
+
sortTime: b,
|
|
223
|
+
fov: v,
|
|
224
|
+
position: T,
|
|
225
|
+
lookUp: w,
|
|
226
|
+
lookAt: I,
|
|
227
|
+
worker: S,
|
|
228
|
+
scene: D,
|
|
229
|
+
// updateSceneData,
|
|
230
|
+
scale: E,
|
|
231
|
+
cuts: M,
|
|
232
|
+
shDegree: F
|
|
233
|
+
} = {}) => {
|
|
234
|
+
if (!n(re)) return;
|
|
235
|
+
F !== void 0 && f("shDegree", `${F}`), p !== void 0 && f("renderSplatCount", `${p}`), y !== void 0 && f("visibleSplatCount", `${y}`), g !== void 0 && f("modelSplatCount", `${g}`), m !== void 0 && f("fps", m), x !== void 0 && f("realFps", `raw ${x}`), b !== void 0 && f("sort", `${b} ms`), !a && n(ee) ? M !== void 0 && f("cuts", `(${M} cuts)`) : f("cuts", ""), S && f("worker", `${S}`), D && f("scene", D), v && f("fov", v), T && f("position", T), w && f("lookUp", w), I && f("lookAt", I), I && f("viewer-version", Yt);
|
|
236
|
+
let k = performance.memory || { usedJSHeapSize: 0, totalJSHeapSize: 0, jsHeapSizeLimit: 0 }, P = "", U = k.usedJSHeapSize / 1024 / 1024;
|
|
237
|
+
U > 1e3 ? P += (U / 1024).toFixed(2) + " G" : P += U.toFixed(0) + " M", P += " / ";
|
|
238
|
+
let O = k.totalJSHeapSize / 1024 / 1024;
|
|
239
|
+
O > 1e3 ? P += (O / 1024).toFixed(2) + " G" : P += O.toFixed(0) + " M";
|
|
240
|
+
let W = k.jsHeapSizeLimit / 1024 / 1024;
|
|
241
|
+
P += " / ", W > 1e3 ? P += (W / 1024).toFixed(2) + " G" : P += W.toFixed(0) + " M", f("memory", P), E && f("scale", E);
|
|
242
|
+
}
|
|
243
|
+
);
|
|
245
244
|
async function f(p, y) {
|
|
246
245
|
let g = document.querySelector(`#gsviewer .debug .${p}`);
|
|
247
246
|
g && (g.innerText = y);
|
|
@@ -266,7 +265,7 @@ async function qs(i) {
|
|
|
266
265
|
function ne(i) {
|
|
267
266
|
return i < 0 ? 0 : i > 255 ? 255 : i | 0;
|
|
268
267
|
}
|
|
269
|
-
function
|
|
268
|
+
function yt(i) {
|
|
270
269
|
const e = ne(Math.round(i * 128) + 128);
|
|
271
270
|
return ne(Math.floor((e + 4) / 8) * 8);
|
|
272
271
|
}
|
|
@@ -285,17 +284,16 @@ async function lo(i) {
|
|
|
285
284
|
return;
|
|
286
285
|
}
|
|
287
286
|
i.fileSize = o;
|
|
288
|
-
let r = [], c = new Uint8Array(ze), u = new Uint8Array(
|
|
287
|
+
let r = [], c = new Uint8Array(ze), u = new Uint8Array(R), d = 0, l = !1, h = 0, f = 0, p, y = !1;
|
|
289
288
|
for (; ; ) {
|
|
290
289
|
let { done: g, value: m } = await a.read();
|
|
291
|
-
if (g)
|
|
292
|
-
break;
|
|
290
|
+
if (g) break;
|
|
293
291
|
if (i.downloadSize += m.byteLength, r) {
|
|
294
292
|
r.push(m);
|
|
295
|
-
let
|
|
293
|
+
let v = 0;
|
|
296
294
|
for (let I = 0; I < r.length; I++)
|
|
297
|
-
|
|
298
|
-
if (
|
|
295
|
+
v += r[I].byteLength;
|
|
296
|
+
if (v < ze)
|
|
299
297
|
continue;
|
|
300
298
|
let T = 0;
|
|
301
299
|
for (let I = 0; I < r.length; I++)
|
|
@@ -310,14 +308,14 @@ async function lo(i) {
|
|
|
310
308
|
continue;
|
|
311
309
|
}
|
|
312
310
|
}
|
|
313
|
-
if (!
|
|
314
|
-
if (
|
|
315
|
-
u.set(m,
|
|
311
|
+
if (!l) {
|
|
312
|
+
if (d + m.byteLength < 4) {
|
|
313
|
+
u.set(m, d), d += m.byteLength;
|
|
316
314
|
continue;
|
|
317
315
|
}
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
const T = new Int32Array(
|
|
316
|
+
const v = new Uint8Array(d + m.byteLength);
|
|
317
|
+
v.set(u.slice(0, d), 0), v.set(m, d), m = v.slice(4), d = 0, l = !0, p = [], f = 0;
|
|
318
|
+
const T = new Int32Array(v.slice(0, 4).buffer);
|
|
321
319
|
y = T[0] < 0, h = Math.abs(T[0]);
|
|
322
320
|
}
|
|
323
321
|
let x = f + m.byteLength;
|
|
@@ -326,11 +324,11 @@ async function lo(i) {
|
|
|
326
324
|
continue;
|
|
327
325
|
}
|
|
328
326
|
for (; x >= h; ) {
|
|
329
|
-
let
|
|
327
|
+
let v = new Uint8Array(h), T = 0;
|
|
330
328
|
for (let I = 0; I < p.length; I++)
|
|
331
|
-
T + p[I].byteLength < h ? (
|
|
332
|
-
y && (
|
|
333
|
-
const w = await fe(
|
|
329
|
+
T + p[I].byteLength < h ? (v.set(p[I], T), T += p[I].byteLength) : (v.set(p[I].slice(0, h - T), T), m = new Uint8Array(p[I].slice(h - T)));
|
|
330
|
+
y && (v = await qs(v));
|
|
331
|
+
const w = await fe(v);
|
|
334
332
|
if (!w.success) {
|
|
335
333
|
console.error("spx block data parser failed. block format:", w.blockFormat), i.abortController.abort(), i.status = L.Invalid;
|
|
336
334
|
break;
|
|
@@ -341,18 +339,18 @@ async function lo(i) {
|
|
|
341
339
|
const I = Math.min(i.fetchLimit, i.modelSplatCount);
|
|
342
340
|
if (w.isSh3)
|
|
343
341
|
if (i.sh3Count + w.splatCount > I) {
|
|
344
|
-
const
|
|
345
|
-
i.sh3Data.push(w.datas.slice(0,
|
|
342
|
+
const S = I - i.sh3Count;
|
|
343
|
+
i.sh3Data.push(w.datas.slice(0, S * 16)), i.sh3Count += S;
|
|
346
344
|
} else
|
|
347
345
|
i.sh3Data.push(w.datas), i.sh3Count += w.splatCount;
|
|
348
346
|
else if (i.sh12Count + w.splatCount > I) {
|
|
349
|
-
const
|
|
350
|
-
i.sh12Data.push(w.datas.slice(0,
|
|
347
|
+
const S = I - i.sh12Count;
|
|
348
|
+
i.sh12Data.push(w.datas.slice(0, S * 16)), i.sh12Count += S;
|
|
351
349
|
} else
|
|
352
350
|
i.sh12Data.push(w.datas), i.sh12Count += w.splatCount;
|
|
353
351
|
}
|
|
354
352
|
if (m.byteLength < 4) {
|
|
355
|
-
u.set(m, 0),
|
|
353
|
+
u.set(m, 0), d = m.byteLength, l = !1;
|
|
356
354
|
break;
|
|
357
355
|
} else {
|
|
358
356
|
const I = new Int32Array(m.slice(0, 4).buffer);
|
|
@@ -373,48 +371,48 @@ function uo(i, e) {
|
|
|
373
371
|
const a = 4096;
|
|
374
372
|
if (!t) {
|
|
375
373
|
const c = Math.min(i.fetchLimit, i.modelSplatCount);
|
|
376
|
-
if (!i.splatData && (i.splatData = new Uint8Array(c *
|
|
374
|
+
if (!i.splatData && (i.splatData = new Uint8Array(c * R)), !i.watermarkData && (i.watermarkData = new Uint8Array(0)), i.dataSplatCount + n > c && (n = c - i.dataSplatCount, !n))
|
|
377
375
|
return;
|
|
378
|
-
const u = new Float32Array(e.buffer),
|
|
376
|
+
const u = new Float32Array(e.buffer), d = new Uint32Array(e.buffer);
|
|
379
377
|
for (let h = 0, f = 0, p = 0, y = 0; h < n; h++)
|
|
380
|
-
if (f = u[h * 8], p = u[h * 8 + 1], y = u[h * 8 + 2], i.minX = Math.min(i.minX, f), i.maxX = Math.max(i.maxX, f), i.minY = Math.min(i.minY, p), i.maxY = Math.max(i.maxY, p), i.minZ = Math.min(i.minZ, y), i.maxZ = Math.max(i.maxZ, y),
|
|
381
|
-
if (i.watermarkCount *
|
|
382
|
-
const g = new Uint8Array((i.watermarkCount + a) *
|
|
378
|
+
if (f = u[h * 8], p = u[h * 8 + 1], y = u[h * 8 + 2], i.minX = Math.min(i.minX, f), i.maxX = Math.max(i.maxX, f), i.minY = Math.min(i.minY, p), i.maxY = Math.max(i.maxY, p), i.minZ = Math.min(i.minZ, y), i.maxZ = Math.max(i.maxZ, y), d[h * 8 + 3] >> 16) {
|
|
379
|
+
if (i.watermarkCount * R === i.watermarkData.byteLength) {
|
|
380
|
+
const g = new Uint8Array((i.watermarkCount + a) * R);
|
|
383
381
|
g.set(i.watermarkData, 0), i.watermarkData = g;
|
|
384
382
|
}
|
|
385
|
-
i.watermarkData.set(e.slice(h * 32, h * 32 + 32), i.watermarkCount++ *
|
|
383
|
+
i.watermarkData.set(e.slice(h * 32, h * 32 + 32), i.watermarkCount++ * R);
|
|
386
384
|
} else
|
|
387
|
-
i.splatData.set(e.slice(h * 32, h * 32 + 32), i.dataSplatCount++ *
|
|
388
|
-
const
|
|
389
|
-
i.currentRadius = Math.sqrt(i.maxX * i.maxX +
|
|
385
|
+
i.splatData.set(e.slice(h * 32, h * 32 + 32), i.dataSplatCount++ * R);
|
|
386
|
+
const l = i.header.MinTopY || 0;
|
|
387
|
+
i.currentRadius = Math.sqrt(i.maxX * i.maxX + l * l + i.maxZ * i.maxZ);
|
|
390
388
|
return;
|
|
391
389
|
}
|
|
392
390
|
let o = Math.min(Math.max(i.meta.autoCut, 2), 50);
|
|
393
391
|
!i.watermarkData && (i.watermarkData = new Uint8Array(0));
|
|
394
392
|
const s = new Float32Array(e.buffer), r = new Uint32Array(e.buffer);
|
|
395
|
-
for (let c = 0, u = Math.floor(e.byteLength /
|
|
393
|
+
for (let c = 0, u = Math.floor(e.byteLength / R), d = 0, l = 0, h = 0, f = ""; c < u; c++) {
|
|
396
394
|
if (r[c * 8 + 3] >> 16) {
|
|
397
|
-
if (i.watermarkCount *
|
|
398
|
-
const m = new Uint8Array((i.watermarkCount + a) *
|
|
395
|
+
if (i.watermarkCount * R === i.watermarkData.byteLength) {
|
|
396
|
+
const m = new Uint8Array((i.watermarkCount + a) * R);
|
|
399
397
|
m.set(i.watermarkData, 0), i.watermarkData = m;
|
|
400
398
|
}
|
|
401
|
-
i.watermarkData.set(e.slice(c * 32, c * 32 + 32), i.watermarkCount++ *
|
|
399
|
+
i.watermarkData.set(e.slice(c * 32, c * 32 + 32), i.watermarkCount++ * R);
|
|
402
400
|
continue;
|
|
403
401
|
}
|
|
404
|
-
|
|
405
|
-
let p = Math.min(o - 1, Math.floor(Math.max(0,
|
|
402
|
+
d = s[c * 8], l = s[c * 8 + 1], h = s[c * 8 + 2];
|
|
403
|
+
let p = Math.min(o - 1, Math.floor(Math.max(0, d - i.header.MinX) / (i.header.MaxX - i.header.MinX) * o)), y = Math.min(o - 1, Math.floor(Math.max(0, h - i.header.MinZ) / (i.header.MaxZ - i.header.MinZ) * o));
|
|
406
404
|
f = `${p}-${y}`;
|
|
407
405
|
let g = i.map.get(f);
|
|
408
406
|
if (!g)
|
|
409
|
-
g = {}, g.minX =
|
|
407
|
+
g = {}, g.minX = d, g.maxX = d, g.minY = l, g.maxY = l, g.minZ = h, g.maxZ = h, g.centerX = d, g.centerY = l, g.centerZ = h, g.radius = 0, g.splatData = new Uint8Array(a * R), g.splatData.set(e.slice(c * R, c * R + R), 0), g.splatCount = 1, i.map.set(f, g);
|
|
410
408
|
else {
|
|
411
|
-
if (g.splatData.byteLength /
|
|
412
|
-
const
|
|
413
|
-
|
|
409
|
+
if (g.splatData.byteLength / R == g.splatCount) {
|
|
410
|
+
const v = new Uint8Array(g.splatData.byteLength + a * R);
|
|
411
|
+
v.set(g.splatData, 0), g.splatData = v;
|
|
414
412
|
}
|
|
415
|
-
g.minX = Math.min(g.minX,
|
|
413
|
+
g.minX = Math.min(g.minX, d), g.maxX = Math.max(g.maxX, d), g.minY = Math.min(g.minY, l), g.maxY = Math.max(g.maxY, l), g.minZ = Math.min(g.minZ, h), g.maxZ = Math.max(g.maxZ, h), g.centerX = (g.maxX + g.minX) / 2, g.centerY = (g.maxY + g.minY) / 2, g.centerZ = (g.maxZ + g.minZ) / 2;
|
|
416
414
|
const m = g.maxX - g.minX, x = g.maxY - g.minY, b = g.maxZ - g.minZ;
|
|
417
|
-
g.radius = Math.sqrt(m * m + x * x + b * b) / 2, g.splatData.set(e.slice(c *
|
|
415
|
+
g.radius = Math.sqrt(m * m + x * x + b * b) / 2, g.splatData.set(e.slice(c * R, c * R + R), g.splatCount++ * R);
|
|
418
416
|
}
|
|
419
417
|
i.dataSplatCount++;
|
|
420
418
|
}
|
|
@@ -430,24 +428,23 @@ async function ho(i) {
|
|
|
430
428
|
}
|
|
431
429
|
const r = s.body.getReader(), c = parseInt(s.headers.get("content-length") || "0");
|
|
432
430
|
i.fileSize = c, i.downloadSize = 0, i.downloadSplatCount = 0, i.watermarkData = new Uint8Array(0);
|
|
433
|
-
let u = new Uint8Array(256),
|
|
431
|
+
let u = new Uint8Array(256), d = 0, l = [], h;
|
|
434
432
|
for (; ; ) {
|
|
435
433
|
let { done: f, value: p } = await r.read();
|
|
436
|
-
if (f)
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (d.push(p), i.downloadSize < 200)
|
|
434
|
+
if (f) break;
|
|
435
|
+
if (i.downloadSize += p.byteLength, l) {
|
|
436
|
+
if (l.push(p), i.downloadSize < 200)
|
|
440
437
|
continue;
|
|
441
438
|
const y = new Uint8Array(i.downloadSize);
|
|
442
|
-
for (let g = 0, m = 0; g <
|
|
443
|
-
y.set(
|
|
439
|
+
for (let g = 0, m = 0; g < l.length; g++)
|
|
440
|
+
y.set(l[g], m), m += l[g].byteLength;
|
|
444
441
|
if (h = n(y), !h) {
|
|
445
|
-
|
|
442
|
+
l = [y];
|
|
446
443
|
continue;
|
|
447
444
|
}
|
|
448
|
-
|
|
445
|
+
l = null, p = y.slice(h.headerLength), i.rowLength = h.rowLength, i.dataShDegree = h.shDegree, i.modelSplatCount = h.vertexCount, i.splatData = new Uint8Array(Math.min(i.modelSplatCount, i.fetchLimit) * 32);
|
|
449
446
|
}
|
|
450
|
-
|
|
447
|
+
d + p.byteLength < i.rowLength ? (u.set(p, d), d += p.byteLength) : (d = await e(h, i, d, u, p), d && u.set(p.slice(p.byteLength - d), 0)), i.downloadSplatCount >= i.fetchLimit && i.abortController.abort();
|
|
451
448
|
}
|
|
452
449
|
} catch (a) {
|
|
453
450
|
a.name === "AbortError" ? (console.log("Fetch Abort", i.opts.url), i.status === L.Fetching && (i.status = L.FetchAborted)) : (console.error(a), i.status === L.Fetching && (i.status = L.FetchFailed));
|
|
@@ -456,15 +453,15 @@ async function ho(i) {
|
|
|
456
453
|
}
|
|
457
454
|
async function e(a, o, s, r, c) {
|
|
458
455
|
return new Promise(async (u) => {
|
|
459
|
-
let
|
|
460
|
-
s ? (h = new Uint8Array(
|
|
456
|
+
let d = (s + c.byteLength) / o.rowLength | 0, l = (s + c.byteLength) % o.rowLength, h;
|
|
457
|
+
s ? (h = new Uint8Array(d * o.rowLength), h.set(r.slice(0, s), 0), h.set(c.slice(0, c.byteLength - l), s)) : h = c.slice(0, d * o.rowLength), o.downloadSplatCount + d > o.fetchLimit && (d = o.fetchLimit - o.downloadSplatCount, l = 0);
|
|
461
458
|
const f = async () => {
|
|
462
|
-
if (
|
|
459
|
+
if (d > je) {
|
|
463
460
|
const p = await t(a, h, je);
|
|
464
|
-
Ti(o, p), o.downloadSplatCount += je,
|
|
461
|
+
Ti(o, p), o.downloadSplatCount += je, d -= je, h = h.slice(je * o.rowLength), setTimeout(f);
|
|
465
462
|
} else {
|
|
466
|
-
const p = await t(a, h,
|
|
467
|
-
Ti(o, p), o.downloadSplatCount +=
|
|
463
|
+
const p = await t(a, h, d);
|
|
464
|
+
Ti(o, p), o.downloadSplatCount += d, u(l);
|
|
468
465
|
}
|
|
469
466
|
};
|
|
470
467
|
await f();
|
|
@@ -472,59 +469,58 @@ async function ho(i) {
|
|
|
472
469
|
}
|
|
473
470
|
async function t(a, o, s) {
|
|
474
471
|
const r = new Uint8Array(s * Za), c = new Float32Array(o.buffer), u = new Float32Array(r.buffer);
|
|
475
|
-
for (let
|
|
476
|
-
u[
|
|
472
|
+
for (let d = 0; d < s; d++)
|
|
473
|
+
u[d * 8 + 0] = c[(d * i.rowLength + a.offsets.x) / 4], u[d * 8 + 1] = c[(d * i.rowLength + a.offsets.y) / 4], u[d * 8 + 2] = c[(d * i.rowLength + a.offsets.z) / 4], u[d * 8 + 3] = Math.exp(c[(d * i.rowLength + a.offsets.scale_0) / 4]), u[d * 8 + 4] = Math.exp(c[(d * i.rowLength + a.offsets.scale_1) / 4]), u[d * 8 + 5] = Math.exp(c[(d * i.rowLength + a.offsets.scale_2) / 4]), r[d * 32 + 24] = ne((0.5 + Et * c[(d * i.rowLength + a.offsets.f_dc_0) / 4]) * 255), r[d * 32 + 25] = ne((0.5 + Et * c[(d * i.rowLength + a.offsets.f_dc_1) / 4]) * 255), r[d * 32 + 26] = ne((0.5 + Et * c[(d * i.rowLength + a.offsets.f_dc_2) / 4]) * 255), r[d * 32 + 27] = ne(1 / (1 + Math.exp(-c[(d * i.rowLength + a.offsets.opacity) / 4])) * 255), r[d * 32 + 28] = ne(c[(d * i.rowLength + a.offsets.rot_0) / 4] * 128 + 128), r[d * 32 + 29] = ne(c[(d * i.rowLength + a.offsets.rot_1) / 4] * 128 + 128), r[d * 32 + 30] = ne(c[(d * i.rowLength + a.offsets.rot_2) / 4] * 128 + 128), r[d * 32 + 31] = ne(c[(d * i.rowLength + a.offsets.rot_3) / 4] * 128 + 128);
|
|
477
474
|
if (a.shDegree == 3) {
|
|
478
|
-
const
|
|
479
|
-
f[0] = s, f[1] = ut,
|
|
475
|
+
const l = new Uint8Array(s * 24 + 8), h = new Uint8Array(s * 21 + 8), f = new Uint32Array(2);
|
|
476
|
+
f[0] = s, f[1] = ut, l.set(new Uint8Array(f.buffer), 0);
|
|
480
477
|
const p = new Uint32Array(2);
|
|
481
478
|
p[0] = s, p[1] = $n, h.set(new Uint8Array(p.buffer), 0);
|
|
482
479
|
for (let m = 0, x = 0; m < s; m++)
|
|
483
480
|
for (let b = 0; b < 8; b++)
|
|
484
|
-
for (let
|
|
485
|
-
|
|
481
|
+
for (let v = 0; v < 3; v++)
|
|
482
|
+
l[8 + x++] = yt(c[(m * i.rowLength + a.offsets["f_rest_" + (b + v * 15)]) / 4]);
|
|
486
483
|
for (let m = 0, x = 0; m < s; m++)
|
|
487
484
|
for (let b = 8; b < 15; b++)
|
|
488
|
-
for (let
|
|
489
|
-
h[8 + x++] =
|
|
490
|
-
const y = await fe(
|
|
485
|
+
for (let v = 0; v < 3; v++)
|
|
486
|
+
h[8 + x++] = yt(c[(m * i.rowLength + a.offsets["f_rest_" + (b + v * 15)]) / 4]);
|
|
487
|
+
const y = await fe(l);
|
|
491
488
|
i.sh12Data.push(y.datas);
|
|
492
489
|
const g = await fe(h);
|
|
493
490
|
i.sh3Data.push(g.datas);
|
|
494
491
|
} else if (a.shDegree == 2) {
|
|
495
|
-
const
|
|
496
|
-
h[0] = s, h[1] = ut,
|
|
492
|
+
const l = new Uint8Array(s * 24 + 8), h = new Uint32Array(2);
|
|
493
|
+
h[0] = s, h[1] = ut, l.set(new Uint8Array(h.buffer), 0);
|
|
497
494
|
for (let p = 0, y = 0; p < s; p++)
|
|
498
495
|
for (let g = 0; g < 8; g++)
|
|
499
496
|
for (let m = 0; m < 3; m++)
|
|
500
|
-
|
|
501
|
-
const f = await fe(
|
|
497
|
+
l[8 + y++] = yt(c[(p * i.rowLength + a.offsets["f_rest_" + (g + m * 8)]) / 4]);
|
|
498
|
+
const f = await fe(l);
|
|
502
499
|
i.sh12Data.push(f.datas);
|
|
503
500
|
} else if (a.shDegree == 1) {
|
|
504
|
-
const
|
|
505
|
-
h[0] = s, h[1] =
|
|
501
|
+
const l = new Uint8Array(s * 9 + 8), h = new Uint32Array(2);
|
|
502
|
+
h[0] = s, h[1] = Xn, l.set(new Uint8Array(h.buffer), 0);
|
|
506
503
|
for (let p = 0, y = 0; p < s; p++)
|
|
507
504
|
for (let g = 0; g < 3; g++)
|
|
508
505
|
for (let m = 0; m < 3; m++)
|
|
509
|
-
|
|
510
|
-
const f = await fe(
|
|
506
|
+
l[8 + y++] = yt(c[(p * i.rowLength + a.offsets["f_rest_" + (g + m * 3)]) / 4]);
|
|
507
|
+
const f = await fe(l);
|
|
511
508
|
i.sh12Data.push(f.datas);
|
|
512
509
|
}
|
|
513
|
-
return await
|
|
510
|
+
return await bn(r, s);
|
|
514
511
|
}
|
|
515
512
|
function n(a) {
|
|
516
513
|
let o = new TextDecoder().decode(a.slice(0, 2048));
|
|
517
514
|
const s = `end_header
|
|
518
515
|
`, r = o.indexOf(s);
|
|
519
516
|
if (r < 0) {
|
|
520
|
-
if (a.byteLength > 1024 * 2)
|
|
521
|
-
throw new Error("Unable to read .ply file header");
|
|
517
|
+
if (a.byteLength > 1024 * 2) throw new Error("Unable to read .ply file header");
|
|
522
518
|
return null;
|
|
523
519
|
}
|
|
524
520
|
if (!o.startsWith("ply") || o.indexOf("format binary_little_endian 1.0") < 0)
|
|
525
521
|
throw new Error("Unknow .ply file header");
|
|
526
522
|
const c = parseInt(/element vertex (\d+)\n/.exec(o)[1]);
|
|
527
|
-
let u = 0,
|
|
523
|
+
let u = 0, d = {}, l = {};
|
|
528
524
|
const h = {
|
|
529
525
|
double: "getFloat64",
|
|
530
526
|
int: "getInt32",
|
|
@@ -537,23 +533,23 @@ async function ho(i) {
|
|
|
537
533
|
for (let y of o.slice(0, r).split(`
|
|
538
534
|
`).filter((g) => g.startsWith("property "))) {
|
|
539
535
|
const [g, m, x] = y.split(" "), b = h[m] || "getInt8";
|
|
540
|
-
|
|
536
|
+
l[x] = b, d[x] = u, u += parseInt(b.replace(/[^\d]/g, "")) / 8;
|
|
541
537
|
}
|
|
542
538
|
let f = 0;
|
|
543
|
-
|
|
539
|
+
l.f_rest_44 ? f = 3 : l.f_rest_23 ? f = 2 : l.f_rest_8 && (f = 1);
|
|
544
540
|
const p = ["x", "y", "z", "scale_0", "scale_1", "scale_2", "f_dc_0", "f_dc_1", "f_dc_2", "opacity", "rot_0", "rot_1", "rot_2", "rot_3"];
|
|
545
541
|
for (let y = 0; y < p.length; y++) {
|
|
546
542
|
const g = p[y];
|
|
547
|
-
if (!
|
|
543
|
+
if (!l[g])
|
|
548
544
|
throw new Error(`Property not found: ${g}`);
|
|
549
545
|
}
|
|
550
|
-
return { headerLength: r + s.length, offsets:
|
|
546
|
+
return { headerLength: r + s.length, offsets: d, rowLength: u, vertexCount: c, shDegree: f };
|
|
551
547
|
}
|
|
552
548
|
}
|
|
553
549
|
function Ti(i, e) {
|
|
554
|
-
let t = e.byteLength /
|
|
550
|
+
let t = e.byteLength / R;
|
|
555
551
|
const n = Math.min(i.fetchLimit, i.modelSplatCount);
|
|
556
|
-
i.dataSplatCount + t > n ? (t = n - i.dataSplatCount, i.splatData.set(e.slice(0, t *
|
|
552
|
+
i.dataSplatCount + t > n ? (t = n - i.dataSplatCount, i.splatData.set(e.slice(0, t * R), i.dataSplatCount * R)) : i.splatData.set(e, i.dataSplatCount * R);
|
|
557
553
|
const a = new Float32Array(e.buffer);
|
|
558
554
|
for (let s = 0, r = 0, c = 0, u = 0; s < t; s++)
|
|
559
555
|
r = a[s * 8], c = a[s * 8 + 1], u = a[s * 8 + 2], i.minX = Math.min(i.minX, r), i.maxX = Math.max(i.maxX, r), i.minY = Math.min(i.minY, c), i.maxY = Math.max(i.maxY, c), i.minZ = Math.min(i.minZ, u), i.maxZ = Math.max(i.maxZ, u);
|
|
@@ -561,7 +557,7 @@ function Ti(i, e) {
|
|
|
561
557
|
const o = 0;
|
|
562
558
|
i.currentRadius = Math.sqrt(i.maxX * i.maxX + o * o + i.maxZ * i.maxZ), i.aabbCenter = new C((i.minX + i.maxX) / 2, (i.minY + i.maxY) / 2, (i.minZ + i.maxZ) / 2);
|
|
563
559
|
}
|
|
564
|
-
const z = le ? 20480 : 51200,
|
|
560
|
+
const z = le ? 20480 : 51200, Zt = 16;
|
|
565
561
|
async function po(i) {
|
|
566
562
|
try {
|
|
567
563
|
i.status = L.Fetching;
|
|
@@ -575,85 +571,84 @@ async function po(i) {
|
|
|
575
571
|
const u = new Uint8Array(c);
|
|
576
572
|
for (; ; ) {
|
|
577
573
|
let { done: h, value: f } = await r.read();
|
|
578
|
-
if (h)
|
|
579
|
-
break;
|
|
574
|
+
if (h) break;
|
|
580
575
|
u.set(f, i.downloadSize), i.downloadSize += f.length;
|
|
581
576
|
}
|
|
582
|
-
const
|
|
583
|
-
if (!
|
|
577
|
+
const d = await qs(u);
|
|
578
|
+
if (!d || d.length < 16) {
|
|
584
579
|
console.error("Invalid spz format"), i.status = L.Invalid;
|
|
585
580
|
return;
|
|
586
581
|
}
|
|
587
|
-
const
|
|
588
|
-
i.modelSplatCount =
|
|
582
|
+
const l = n(d);
|
|
583
|
+
i.modelSplatCount = l.numPoints, i.dataShDegree = l.shDegree, i.splatData = new Uint8Array(Math.min(i.modelSplatCount, i.fetchLimit) * 32), await e(l, i, d);
|
|
589
584
|
} catch (a) {
|
|
590
585
|
a.name === "AbortError" ? (console.log("Fetch Abort", i.opts.url), i.status === L.Fetching && (i.status = L.FetchAborted)) : (console.error(a), i.status === L.Fetching && (i.status = L.FetchFailed));
|
|
591
586
|
} finally {
|
|
592
587
|
i.status === L.Fetching && (i.status = L.FetchDone);
|
|
593
588
|
}
|
|
594
589
|
async function e(a, o, s) {
|
|
595
|
-
const r = a.numPoints * 9, c = a.numPoints, u = a.numPoints * 3,
|
|
596
|
-
for (let
|
|
597
|
-
let T =
|
|
590
|
+
const r = a.numPoints * 9, c = a.numPoints, u = a.numPoints * 3, d = a.numPoints * 3, l = a.numPoints * 3, h = Zt, f = h + r, p = f + c, y = p + u, g = y + d, m = g + l, x = Math.min(a.numPoints, o.fetchLimit), b = Math.ceil(x / z);
|
|
591
|
+
for (let v = 0; v < b; v++) {
|
|
592
|
+
let T = v < b - 1 ? z : x - v * z;
|
|
598
593
|
o.dataSplatCount + T > o.fetchLimit && (T = o.fetchLimit - o.dataSplatCount);
|
|
599
594
|
const w = new Uint8Array(T * 20 + 8), I = new Uint32Array(2);
|
|
600
595
|
I[0] = T, I[1] = no, w.set(new Uint8Array(I.buffer), 0);
|
|
601
|
-
let
|
|
596
|
+
let S = 8;
|
|
602
597
|
for (let M = 0; M < T; M++)
|
|
603
|
-
w[
|
|
598
|
+
w[S++] = s[h + (v * z + M) * 9 + 0], w[S++] = s[h + (v * z + M) * 9 + 1], w[S++] = s[h + (v * z + M) * 9 + 2];
|
|
604
599
|
for (let M = 0; M < T; M++)
|
|
605
|
-
w[
|
|
600
|
+
w[S++] = s[h + (v * z + M) * 9 + 3], w[S++] = s[h + (v * z + M) * 9 + 4], w[S++] = s[h + (v * z + M) * 9 + 5];
|
|
606
601
|
for (let M = 0; M < T; M++)
|
|
607
|
-
w[
|
|
602
|
+
w[S++] = s[h + (v * z + M) * 9 + 6], w[S++] = s[h + (v * z + M) * 9 + 7], w[S++] = s[h + (v * z + M) * 9 + 8];
|
|
608
603
|
for (let M = 0; M < T; M++)
|
|
609
|
-
w[
|
|
604
|
+
w[S++] = s[y + (v * z + M) * 3];
|
|
610
605
|
for (let M = 0; M < T; M++)
|
|
611
|
-
w[
|
|
606
|
+
w[S++] = s[y + (v * z + M) * 3 + 1];
|
|
612
607
|
for (let M = 0; M < T; M++)
|
|
613
|
-
w[
|
|
608
|
+
w[S++] = s[y + (v * z + M) * 3 + 2];
|
|
614
609
|
for (let M = 0; M < T; M++)
|
|
615
|
-
w[
|
|
610
|
+
w[S++] = jt(s[p + (v * z + M) * 3]);
|
|
616
611
|
for (let M = 0; M < T; M++)
|
|
617
|
-
w[
|
|
612
|
+
w[S++] = jt(s[p + (v * z + M) * 3 + 1]);
|
|
618
613
|
for (let M = 0; M < T; M++)
|
|
619
|
-
w[
|
|
614
|
+
w[S++] = jt(s[p + (v * z + M) * 3 + 2]);
|
|
620
615
|
const D = [];
|
|
621
|
-
for (let M = 0,
|
|
622
|
-
w[
|
|
616
|
+
for (let M = 0, F = 0, k = 0, P = 0; M < T; M++)
|
|
617
|
+
w[S++] = s[f + (v * z + M)], F = s[g + (v * z + M) * 3 + 0], k = s[g + (v * z + M) * 3 + 1], P = s[g + (v * z + M) * 3 + 2], D.push(fo(F, k, P));
|
|
623
618
|
for (let M = 0; M < T; M++)
|
|
624
|
-
w[
|
|
619
|
+
w[S++] = D[M][0];
|
|
625
620
|
for (let M = 0; M < T; M++)
|
|
626
|
-
w[
|
|
621
|
+
w[S++] = D[M][1];
|
|
627
622
|
for (let M = 0; M < T; M++)
|
|
628
|
-
w[
|
|
623
|
+
w[S++] = D[M][2];
|
|
629
624
|
for (let M = 0; M < T; M++)
|
|
630
|
-
w[
|
|
631
|
-
const
|
|
632
|
-
if (t(a, o,
|
|
633
|
-
const M = new Uint8Array(T * 9 + 8),
|
|
634
|
-
|
|
625
|
+
w[S++] = D[M][3];
|
|
626
|
+
const E = await fe(w);
|
|
627
|
+
if (t(a, o, E.datas), a.shDegree === 1) {
|
|
628
|
+
const M = new Uint8Array(T * 9 + 8), F = new Uint32Array(2);
|
|
629
|
+
F[0] = T, F[1] = Xn, M.set(new Uint8Array(F.buffer), 0);
|
|
635
630
|
for (let P = 0, U = 8; P < T; P++)
|
|
636
|
-
M.set(s.slice(m + (
|
|
637
|
-
const
|
|
638
|
-
o.sh12Data.push(
|
|
631
|
+
M.set(s.slice(m + (v * z + P) * 9, m + (v * z + P) * 9 + 9), U), U += 9;
|
|
632
|
+
const k = await fe(M);
|
|
633
|
+
o.sh12Data.push(k.datas);
|
|
639
634
|
} else if (a.shDegree === 2) {
|
|
640
|
-
const M = new Uint8Array(T * 24 + 8),
|
|
641
|
-
|
|
635
|
+
const M = new Uint8Array(T * 24 + 8), F = new Uint32Array(2);
|
|
636
|
+
F[0] = T, F[1] = ut, M.set(new Uint8Array(F.buffer), 0);
|
|
642
637
|
for (let P = 0, U = 8; P < T; P++)
|
|
643
|
-
M.set(s.slice(m + (
|
|
644
|
-
const
|
|
645
|
-
o.sh12Data.push(
|
|
638
|
+
M.set(s.slice(m + (v * z + P) * 24, m + (v * z + P) * 24 + 24), U), U += 24;
|
|
639
|
+
const k = await fe(M);
|
|
640
|
+
o.sh12Data.push(k.datas);
|
|
646
641
|
} else if (a.shDegree === 3) {
|
|
647
|
-
const M = new Uint8Array(T * 24 + 8),
|
|
648
|
-
|
|
642
|
+
const M = new Uint8Array(T * 24 + 8), F = new Uint32Array(2);
|
|
643
|
+
F[0] = T, F[1] = ut, M.set(new Uint8Array(F.buffer), 0);
|
|
649
644
|
for (let W = 0, se = 8; W < T; W++)
|
|
650
|
-
M.set(s.slice(m + (
|
|
651
|
-
const
|
|
652
|
-
o.sh12Data.push(
|
|
645
|
+
M.set(s.slice(m + (v * z + W) * 45, m + (v * z + W) * 45 + 24), se), se += 24;
|
|
646
|
+
const k = await fe(M);
|
|
647
|
+
o.sh12Data.push(k.datas);
|
|
653
648
|
const P = new Uint8Array(T * 21 + 8), U = new Uint32Array(2);
|
|
654
649
|
U[0] = T, U[1] = $n, P.set(new Uint8Array(U.buffer), 0);
|
|
655
650
|
for (let W = 0, se = 8; W < T; W++)
|
|
656
|
-
P.set(s.slice(m + (
|
|
651
|
+
P.set(s.slice(m + (v * z + W) * 45 + 24, m + (v * z + W) * 45 + 45), se), se += 21;
|
|
657
652
|
const O = await fe(P);
|
|
658
653
|
o.sh3Data.push(O.datas);
|
|
659
654
|
}
|
|
@@ -662,60 +657,55 @@ async function po(i) {
|
|
|
662
657
|
}
|
|
663
658
|
}
|
|
664
659
|
function t(a, o, s) {
|
|
665
|
-
let r = s.byteLength /
|
|
660
|
+
let r = s.byteLength / R;
|
|
666
661
|
const c = Math.min(o.fetchLimit, a.numPoints);
|
|
667
|
-
o.dataSplatCount + r > c ? (r = c - o.dataSplatCount, o.splatData.set(s.slice(0, r *
|
|
662
|
+
o.dataSplatCount + r > c ? (r = c - o.dataSplatCount, o.splatData.set(s.slice(0, r * R), o.dataSplatCount * R)) : o.splatData.set(s, o.dataSplatCount * R);
|
|
668
663
|
const u = new Float32Array(s.buffer);
|
|
669
|
-
for (let
|
|
670
|
-
h = u[
|
|
664
|
+
for (let l = 0, h = 0, f = 0, p = 0; l < r; l++)
|
|
665
|
+
h = u[l * 8], f = u[l * 8 + 1], p = u[l * 8 + 2], o.minX = Math.min(o.minX, h), o.maxX = Math.max(o.maxX, h), o.minY = Math.min(o.minY, f), o.maxY = Math.max(o.maxY, f), o.minZ = Math.min(o.minZ, p), o.maxZ = Math.max(o.maxZ, p);
|
|
671
666
|
o.dataSplatCount += r, o.downloadSplatCount += r;
|
|
672
|
-
const
|
|
673
|
-
o.currentRadius = Math.sqrt(o.maxX * o.maxX +
|
|
667
|
+
const d = 0;
|
|
668
|
+
o.currentRadius = Math.sqrt(o.maxX * o.maxX + d * d + o.maxZ * o.maxZ), o.aabbCenter = new C((o.minX + o.maxX) / 2, (o.minY + o.maxY) / 2, (o.minZ + o.maxZ) / 2);
|
|
674
669
|
}
|
|
675
670
|
function n(a) {
|
|
676
|
-
const o = a.slice(0,
|
|
677
|
-
if (r.magic = s[0], r.version = s[1], r.numPoints = s[2], r.shDegree = o[12], r.fractionalBits = o[13], r.flags = o[14], r.reserved = o[15], r.magic !== 1347635022)
|
|
678
|
-
|
|
679
|
-
if (r.
|
|
680
|
-
|
|
681
|
-
if (r.shDegree > 3)
|
|
682
|
-
throw new Error("[SPZ ERROR] unsupported SH degree:" + r.shDegree);
|
|
683
|
-
if (r.fractionalBits !== 12)
|
|
684
|
-
throw new Error("[SPZ ERROR] unsupported FractionalBits:" + r.fractionalBits);
|
|
671
|
+
const o = a.slice(0, Zt), s = new Uint32Array(o.buffer), r = {};
|
|
672
|
+
if (r.magic = s[0], r.version = s[1], r.numPoints = s[2], r.shDegree = o[12], r.fractionalBits = o[13], r.flags = o[14], r.reserved = o[15], r.magic !== 1347635022) throw new Error("[SPZ ERROR] header not found");
|
|
673
|
+
if (r.version !== 2) throw new Error("[SPZ ERROR] ersion not supported:" + r.version);
|
|
674
|
+
if (r.shDegree > 3) throw new Error("[SPZ ERROR] unsupported SH degree:" + r.shDegree);
|
|
675
|
+
if (r.fractionalBits !== 12) throw new Error("[SPZ ERROR] unsupported FractionalBits:" + r.fractionalBits);
|
|
685
676
|
let c = 0;
|
|
686
|
-
if (r.shDegree === 1 ? c = 9 : r.shDegree === 2 ? c = 24 : r.shDegree === 3 && (c = 45), a.length !==
|
|
687
|
-
throw new Error("[SPZ ERROR] invalid spz data");
|
|
677
|
+
if (r.shDegree === 1 ? c = 9 : r.shDegree === 2 ? c = 24 : r.shDegree === 3 && (c = 45), a.length !== Zt + r.numPoints * (19 + c)) throw new Error("[SPZ ERROR] invalid spz data");
|
|
688
678
|
return r;
|
|
689
679
|
}
|
|
690
680
|
}
|
|
691
|
-
function
|
|
681
|
+
function jt(i) {
|
|
692
682
|
const e = (i - 127.5) / 38.25;
|
|
693
|
-
return ne((0.5 +
|
|
683
|
+
return ne((0.5 + Et * e) * 255);
|
|
694
684
|
}
|
|
695
685
|
function fo(i, e, t) {
|
|
696
686
|
const n = i / 127.5 - 1, a = e / 127.5 - 1, o = t / 127.5 - 1, s = Math.sqrt(Math.max(0, 1 - (n * n + a * a + o * o)));
|
|
697
687
|
return [ne(s * 128 + 128), ne(n * 128 + 128), ne(a * 128 + 128), ne(o * 128 + 128)];
|
|
698
688
|
}
|
|
699
689
|
function go(i) {
|
|
700
|
-
const e = (x, b,
|
|
690
|
+
const e = (x, b, v) => i.on(x, b, v), t = (x, ...b) => i.fire(x, ...b);
|
|
701
691
|
let n, a = Date.now() + 36e5, o = null, s, r = { index: 0, version: 0 }, c = { version: 0 }, u = !1;
|
|
702
|
-
const
|
|
692
|
+
const d = t(ee);
|
|
703
693
|
e(Ys, () => s?.aabbCenter || new C());
|
|
704
|
-
let
|
|
705
|
-
const h = new Promise((x) =>
|
|
694
|
+
let l;
|
|
695
|
+
const h = new Promise((x) => l = x);
|
|
706
696
|
e(ot, async () => {
|
|
707
697
|
const x = t(_);
|
|
708
698
|
let b = le ? x.maxRenderCountOfMobile : x.maxRenderCountOfPc;
|
|
709
699
|
if (!x.bigSceneMode) {
|
|
710
|
-
let
|
|
711
|
-
b = Math.min(
|
|
700
|
+
let v = await h;
|
|
701
|
+
b = Math.min(v, b) + 10240;
|
|
712
702
|
}
|
|
713
703
|
return b;
|
|
714
704
|
}), e(Je, async (x) => {
|
|
715
705
|
const b = t(_);
|
|
716
706
|
if (b.bigSceneMode) return 1;
|
|
717
|
-
let
|
|
718
|
-
if (
|
|
707
|
+
let v = le ? b.maxRenderCountOfMobile : b.maxRenderCountOfPc, T = await h;
|
|
708
|
+
if (v = Math.min(T, v), !s.dataShDegree) return 1;
|
|
719
709
|
if (x >= 3) {
|
|
720
710
|
if (s.dataShDegree < 3) return 1;
|
|
721
711
|
} else if (x >= 1) {
|
|
@@ -723,22 +713,22 @@ function go(i) {
|
|
|
723
713
|
} else
|
|
724
714
|
return 1;
|
|
725
715
|
const w = 1024 * 2;
|
|
726
|
-
return Math.ceil(
|
|
727
|
-
}), e(
|
|
716
|
+
return Math.ceil(v / w);
|
|
717
|
+
}), e(Gn, async () => t(_).bigSceneMode ? 0 : (await h, s.dataShDegree)), e(Qn, async (x, b = !0) => {
|
|
728
718
|
try {
|
|
729
719
|
await h;
|
|
730
|
-
const
|
|
731
|
-
o = await t(
|
|
720
|
+
const v = !!s.header?.Flag2;
|
|
721
|
+
o = await t(Rs, x, b, v), s && (s.textWatermarkVersion = Date.now());
|
|
732
722
|
} catch {
|
|
733
723
|
console.info("failed to generate watermark");
|
|
734
724
|
}
|
|
735
|
-
}), e(
|
|
736
|
-
if (
|
|
725
|
+
}), e(gn, () => {
|
|
726
|
+
if (d) return r.version <= c.version ? r.xyz : c.xyz;
|
|
737
727
|
if (s?.status === L.FetchDone || s?.status === L.FetchAborted) {
|
|
738
728
|
if (s.activePoints && s.activePoints.length === void 0) return s.activePoints;
|
|
739
729
|
const x = {}, b = r.xyz;
|
|
740
|
-
for (let
|
|
741
|
-
w = b[
|
|
730
|
+
for (let v = 0, T = b.length / 3, w = 0, I = 0, S = 0, D = ""; v < T; v++)
|
|
731
|
+
w = b[v * 3], I = b[v * 3 + 1], S = b[v * 3 + 2], D = `${Math.floor(w / 2) * 2 + 1},${Math.floor(I / 2) * 2 + 1},${Math.floor(S / 2) * 2 + 1}`, (x[D] = x[D] || []).push(w, I, S);
|
|
742
732
|
return s.activePoints = x;
|
|
743
733
|
}
|
|
744
734
|
return r.xyz;
|
|
@@ -746,12 +736,12 @@ function go(i) {
|
|
|
746
736
|
async function f(x) {
|
|
747
737
|
if (n) return;
|
|
748
738
|
if (s && (s.status === L.Invalid || s.status === L.FetchFailed))
|
|
749
|
-
return t(_).viewerEvents?.fire(q), t(
|
|
739
|
+
return t(_).viewerEvents?.fire(q), t(Mt, 0) || t(oe, { renderSplatCount: 0, visibleSplatCount: 0, modelSplatCount: 0 });
|
|
750
740
|
if (!s || !s.downloadSize) return;
|
|
751
741
|
const b = s.status !== L.FetchReady && s.status !== L.Fetching;
|
|
752
742
|
if (b) {
|
|
753
|
-
const
|
|
754
|
-
!s.notifyFetchStopDone && (s.notifyFetchStopDone = !0) && t(
|
|
743
|
+
const v = Math.min(s.fetchLimit, s.downloadSplatCount);
|
|
744
|
+
!s.notifyFetchStopDone && (s.notifyFetchStopDone = !0) && t(Mt, v);
|
|
755
745
|
} else
|
|
756
746
|
t(Ts, 100 * s.downloadSize / s.fileSize);
|
|
757
747
|
s.downloadSplatCount && (u || (u = !0, setTimeout(async () => {
|
|
@@ -760,25 +750,25 @@ function go(i) {
|
|
|
760
750
|
}
|
|
761
751
|
async function p(x) {
|
|
762
752
|
if (n) return;
|
|
763
|
-
const b = r,
|
|
764
|
-
let w = s.dataSplatCount, I = x ? s.watermarkCount : 0,
|
|
765
|
-
if (s.renderSplatCount = w + I +
|
|
753
|
+
const b = r, v = await t(ot), T = o;
|
|
754
|
+
let w = s.dataSplatCount, I = x ? s.watermarkCount : 0, S = s.meta.showWatermark && x ? (T?.byteLength || 0) / 32 : 0;
|
|
755
|
+
if (s.renderSplatCount = w + I + S, s.renderSplatCount >= v && (s.renderSplatCount = v, I = 0, S = 0, w > v && (w = v)), t(oe, { visibleSplatCount: s.renderSplatCount, modelSplatCount: s.modelSplatCount + S }), Date.now() - b.textureReadyTime < (le ? 600 : 300) || s.smallSceneUploadDone && s.lastTextWatermarkVersion == s.textWatermarkVersion) return;
|
|
766
756
|
if (!b.version) {
|
|
767
757
|
t(ms, (s.header?.Flag2 ? s.header.MaxTopY : s.header?.MinTopY) || 0);
|
|
768
758
|
let O = s.opts.format;
|
|
769
759
|
s.opts.format == "spx" && (O = "spx" + (s.header.ExclusiveId ? (" " + s.header.ExclusiveId).substring(0, 6) : "")), t(oe, { scene: `small (${O})` });
|
|
770
760
|
}
|
|
771
761
|
s.lastTextWatermarkVersion = s.textWatermarkVersion, b.textureReady = !1;
|
|
772
|
-
const D = 1024 * 2,
|
|
773
|
-
|
|
762
|
+
const D = 1024 * 2, E = Math.ceil(2 * v / D), M = new Uint32Array(D * E * 4), F = new Float32Array(M.buffer), k = new Uint8Array(M.buffer);
|
|
763
|
+
k.set(s.splatData.slice(0, w * 32), 0), I && k.set(s.watermarkData.slice(0, I * 32), w * 32), S && k.set(T.slice(0, S * 32), (w + I) * 32);
|
|
774
764
|
const P = new Float32Array(s.renderSplatCount * 3);
|
|
775
765
|
for (let O = 0, W = 0; O < s.renderSplatCount; O++)
|
|
776
|
-
P[O * 3] =
|
|
766
|
+
P[O * 3] = F[O * 8], P[O * 3 + 1] = F[O * 8 + 1], P[O * 3 + 2] = F[O * 8 + 2];
|
|
777
767
|
const U = Date.now();
|
|
778
|
-
if (b.version = U, b.txdata = M, b.xyz = P, b.renderSplatCount = s.renderSplatCount, b.visibleSplatCount = s.downloadSplatCount +
|
|
768
|
+
if (b.version = U, b.txdata = M, b.xyz = P, b.renderSplatCount = s.renderSplatCount, b.visibleSplatCount = s.downloadSplatCount + S, b.modelSplatCount = s.downloadSplatCount + S, b.watermarkCount = I + S, b.minX = s.minX, b.maxX = s.maxX, b.minY = s.minY, b.maxY = s.maxY, b.minZ = s.minZ, b.maxZ = s.maxZ, t(zs, b, s.currentRadius, s.currentRadius), a = U, x && !s.smallSceneUploadDone) {
|
|
779
769
|
s.smallSceneUploadDone = !0, t(Qs, s.sh12Data), t(Hs, s.sh3Data), s.sh12Data = null, s.sh3Data = null;
|
|
780
770
|
const O = t(_);
|
|
781
|
-
t(Fn, O.shDegree === void 0 ? 3 : O.shDegree), t(
|
|
771
|
+
t(Fn, O.shDegree === void 0 ? 3 : O.shDegree), t(gn);
|
|
782
772
|
}
|
|
783
773
|
t(oe, { renderSplatCount: s.renderSplatCount });
|
|
784
774
|
}
|
|
@@ -800,30 +790,30 @@ function go(i) {
|
|
|
800
790
|
}
|
|
801
791
|
async function m(x, b) {
|
|
802
792
|
if (n) return;
|
|
803
|
-
const
|
|
804
|
-
if (x.fetchReload = ro(b.updateDate || 0), s = new
|
|
805
|
-
const D = b.pcDownloadLimitSplatCount || eo,
|
|
793
|
+
const v = t(_), T = le ? v.maxRenderCountOfMobile : v.maxRenderCountOfPc, w = t(ee);
|
|
794
|
+
if (x.fetchReload = ro(b.updateDate || 0), s = new $a(x, b), w && b.autoCut) {
|
|
795
|
+
const D = b.pcDownloadLimitSplatCount || eo, E = b.mobileDownloadLimitSplatCount || Ja, M = le ? E : D;
|
|
806
796
|
s.fetchLimit = Math.min(b.autoCut * b.autoCut * T + T, M);
|
|
807
797
|
} else
|
|
808
798
|
s.fetchLimit = T;
|
|
809
|
-
const I = Date.now(),
|
|
799
|
+
const I = Date.now(), S = () => {
|
|
810
800
|
if (!s || s.status == L.Invalid || s.status == L.FetchFailed)
|
|
811
|
-
return
|
|
801
|
+
return l(0);
|
|
812
802
|
if (s.modelSplatCount >= 0)
|
|
813
|
-
|
|
803
|
+
l(s.modelSplatCount), setTimeout(() => t(Cs), 5);
|
|
814
804
|
else {
|
|
815
805
|
if (Date.now() - I >= 3e3)
|
|
816
|
-
return
|
|
817
|
-
setTimeout(
|
|
806
|
+
return l(0);
|
|
807
|
+
setTimeout(S, 10);
|
|
818
808
|
}
|
|
819
809
|
};
|
|
820
|
-
if (
|
|
821
|
-
console.error("Unsupported format:", x.format), t(
|
|
810
|
+
if (S(), !g(s)) {
|
|
811
|
+
console.error("Unsupported format:", x.format), t(Mt, 0);
|
|
822
812
|
return;
|
|
823
813
|
}
|
|
824
814
|
t(Ms);
|
|
825
815
|
}
|
|
826
|
-
e(
|
|
816
|
+
e(vs, async (x, b) => await m(x, b)), e(Ss, (x = 1e4) => Date.now() - a < x), e(bs, () => y()), t(
|
|
827
817
|
at,
|
|
828
818
|
async () => await f(),
|
|
829
819
|
() => !n
|
|
@@ -1176,7 +1166,7 @@ function wo() {
|
|
|
1176
1166
|
}
|
|
1177
1167
|
`;
|
|
1178
1168
|
}
|
|
1179
|
-
const ki = "currentVisibleRadius", Ei = "currentLightRadius", Js = "realFocusPosition",
|
|
1169
|
+
const ki = "currentVisibleRadius", Ei = "currentLightRadius", Js = "realFocusPosition", qt = "splatShTexture12", Jt = "splatShTexture3", _i = "performanceNow", vo = "waterMarkColor", Ii = "showWaterMark", en = "splatTexture0", tn = "splatTexture1", Di = "bigSceneMode", Pi = "lightFactor", Li = "debugEffect", Fi = "usingIndex", So = "cycleColor", bo = "splatIndex", Ri = "pointMode", Bi = "markPoint", Ui = "shDegree", ht = "viewport", xn = "opacity", Oi = "focal", zi = "topY";
|
|
1180
1170
|
let Q = 0;
|
|
1181
1171
|
Q++;
|
|
1182
1172
|
const Qi = `$${Q++}`;
|
|
@@ -1191,34 +1181,32 @@ const Do = `$${Q++}`;
|
|
|
1191
1181
|
Q++;
|
|
1192
1182
|
const Po = `$${Q++}`;
|
|
1193
1183
|
Q++;
|
|
1194
|
-
const Lo = `$${Q++}`,
|
|
1184
|
+
const Lo = `$${Q++}`, Fo = `$${Q++}`, Ro = `$${Q++}`, Bo = `$${Q++}`, Uo = `$${Q++}`, Oo = `$${Q++}`, zo = `$${Q++}`, Qo = `$${Q++}`;
|
|
1195
1185
|
Q++;
|
|
1196
1186
|
function Ho(i) {
|
|
1197
1187
|
let e = !1;
|
|
1198
|
-
const t = (
|
|
1188
|
+
const t = (l, h, f) => i.on(l, h, f), n = (l, ...h) => i.fire(l, ...h);
|
|
1199
1189
|
let a = 0, o = 0;
|
|
1200
1190
|
const s = [];
|
|
1201
1191
|
let r = 0;
|
|
1202
1192
|
t(Ws, () => r), t(ci, async () => {
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1193
|
+
const l = new rn();
|
|
1194
|
+
l.setIndex([0, 1, 2, 0, 2, 3]);
|
|
1205
1195
|
const h = new Float32Array(4 * 3), f = new He(h, 3);
|
|
1206
|
-
|
|
1207
|
-
let p = new
|
|
1196
|
+
l.setAttribute("position", f), f.setXYZ(0, -2, -2, 0), f.setXYZ(1, -2, 2, 0), f.setXYZ(2, 2, 2, 0), f.setXYZ(3, 2, -2, 0), f.needsUpdate = !0;
|
|
1197
|
+
let p = new rn().copy(l);
|
|
1208
1198
|
const y = await n(ot);
|
|
1209
|
-
if (e)
|
|
1210
|
-
return;
|
|
1199
|
+
if (e) return;
|
|
1211
1200
|
const g = new Uint32Array(y), m = new ca(g, 1, !1);
|
|
1212
|
-
return m.setUsage(la), m.needsUpdate = !0, p.setAttribute(bo, m), p.instanceCount = 0, t(ui, (x, b,
|
|
1213
|
-
n(pi, b), g.set(x, 0), m.clearUpdateRanges(), m.addUpdateRange(0, x.length), m.needsUpdate = !0, p.instanceCount = x.length, n(N), n(oe, { sortTime: `${
|
|
1201
|
+
return m.setUsage(la), m.needsUpdate = !0, p.setAttribute(bo, m), p.instanceCount = 0, t(ui, (x, b, v, T) => {
|
|
1202
|
+
n(pi, b), g.set(x, 0), m.clearUpdateRanges(), m.addUpdateRange(0, x.length), m.needsUpdate = !0, p.instanceCount = x.length, n(N), n(oe, { sortTime: `${v} / ${Date.now() - T}` });
|
|
1214
1203
|
}), t(ka, () => p), t(gi, () => {
|
|
1215
1204
|
m.array = null, p.dispose();
|
|
1216
1205
|
}), p;
|
|
1217
1206
|
}), t(li, async () => {
|
|
1218
|
-
const
|
|
1219
|
-
if (e)
|
|
1220
|
-
|
|
1221
|
-
const h = 1024 * 2, f = Math.ceil(2 * d / h), p = n(_), y = new In({
|
|
1207
|
+
const l = await n(ot);
|
|
1208
|
+
if (e) return;
|
|
1209
|
+
const h = 1024 * 2, f = Math.ceil(2 * l / h), p = n(_), y = new _n({
|
|
1222
1210
|
uniforms: n(ri),
|
|
1223
1211
|
vertexShader: mo(),
|
|
1224
1212
|
fragmentShader: yo(),
|
|
@@ -1232,129 +1220,130 @@ function Ho(i) {
|
|
|
1232
1220
|
side: we
|
|
1233
1221
|
}), g = new Uint32Array(h * f * 4);
|
|
1234
1222
|
let m = new Ee(g, h, f, _e, Ie);
|
|
1235
|
-
m.internalFormat = "RGBA32UI", m.needsUpdate = !0, y.uniforms[
|
|
1223
|
+
m.internalFormat = "RGBA32UI", m.needsUpdate = !0, y.uniforms[en].value = m;
|
|
1236
1224
|
const x = n(ee) ? f : 1, b = new Uint32Array(h * x * 4);
|
|
1237
|
-
let
|
|
1238
|
-
|
|
1225
|
+
let v = new Ee(b, h, x, _e, Ie);
|
|
1226
|
+
v.internalFormat = "RGBA32UI", v.needsUpdate = !0, y.uniforms[tn].value = v;
|
|
1239
1227
|
const T = await n(Je, 1), w = new Uint32Array(h * T * 4);
|
|
1240
1228
|
let I = new Ee(w, h, T, _e, Ie);
|
|
1241
|
-
I.internalFormat = "RGBA32UI", I.needsUpdate = !0, y.uniforms[
|
|
1242
|
-
const
|
|
1243
|
-
let
|
|
1244
|
-
|
|
1229
|
+
I.internalFormat = "RGBA32UI", I.needsUpdate = !0, y.uniforms[qt].value = I;
|
|
1230
|
+
const S = await n(Je, 3), D = new Uint32Array(h * S * 4);
|
|
1231
|
+
let E = new Ee(D, h, S, _e, Ie);
|
|
1232
|
+
E.internalFormat = "RGBA32UI", E.needsUpdate = !0, y.uniforms[Jt].value = E, y.needsUpdate = !0;
|
|
1245
1233
|
let M = !1;
|
|
1246
|
-
t(hi, (
|
|
1234
|
+
t(hi, (k) => {
|
|
1247
1235
|
if (!n(ee)) {
|
|
1248
|
-
if (M && !
|
|
1249
|
-
|
|
1250
|
-
M = !E.renderSplatCount;
|
|
1236
|
+
if (M && !k.renderSplatCount) return;
|
|
1237
|
+
M = !k.renderSplatCount;
|
|
1251
1238
|
}
|
|
1252
|
-
const P =
|
|
1253
|
-
|
|
1239
|
+
const P = k.txdata;
|
|
1240
|
+
k.txdata = null;
|
|
1254
1241
|
const U = new Ee(P, h, f, _e, Ie);
|
|
1255
1242
|
U.onUpdate = () => {
|
|
1256
|
-
|
|
1257
|
-
}, U.internalFormat = "RGBA32UI", U.needsUpdate = !0,
|
|
1258
|
-
}), t(Qs, async (
|
|
1259
|
-
if (n(ee) || !
|
|
1260
|
-
return;
|
|
1243
|
+
k.textureReady = !0, k.textureReadyTime = Date.now(), d(k), n(ks, k.renderSplatCount);
|
|
1244
|
+
}, U.internalFormat = "RGBA32UI", U.needsUpdate = !0, k.index ? (y.uniforms[tn].value = U, v = U) : (y.uniforms[en].value = U, m = U), y.needsUpdate = !0, n(N);
|
|
1245
|
+
}), t(Qs, async (k) => {
|
|
1246
|
+
if (n(ee) || !k || !k.length) return;
|
|
1261
1247
|
const P = new Uint32Array(h * await n(Je, 1) * 4), U = new Uint8Array(P.buffer);
|
|
1262
|
-
for (let W = 0, se = 0; W <
|
|
1263
|
-
U.set(
|
|
1248
|
+
for (let W = 0, se = 0; W < k.length; W++)
|
|
1249
|
+
U.set(k[W], se), se += k[W].byteLength;
|
|
1264
1250
|
const O = new Ee(P, h, T, _e, Ie);
|
|
1265
|
-
O.internalFormat = "RGBA32UI", O.needsUpdate = !0, y.uniforms[
|
|
1266
|
-
}), t(Hs, async (
|
|
1267
|
-
if (n(ee) || !
|
|
1268
|
-
return;
|
|
1251
|
+
O.internalFormat = "RGBA32UI", O.needsUpdate = !0, y.uniforms[qt].value = O, y.needsUpdate = !0, n(N);
|
|
1252
|
+
}), t(Hs, async (k) => {
|
|
1253
|
+
if (n(ee) || !k || !k.length) return;
|
|
1269
1254
|
const P = new Uint32Array(h * await n(Je, 3) * 4), U = new Uint8Array(P.buffer);
|
|
1270
|
-
for (let W = 0, se = 0; W <
|
|
1271
|
-
U.set(
|
|
1255
|
+
for (let W = 0, se = 0; W < k.length; W++)
|
|
1256
|
+
U.set(k[W], se), se += k[W].byteLength;
|
|
1272
1257
|
const O = new Ee(P, h, T, _e, Ie);
|
|
1273
|
-
O.internalFormat = "RGBA32UI", O.needsUpdate = !0, y.uniforms[
|
|
1274
|
-
}), t(di, () => y), t(
|
|
1275
|
-
const
|
|
1258
|
+
O.internalFormat = "RGBA32UI", O.needsUpdate = !0, y.uniforms[Jt].value = O, y.needsUpdate = !0, n(N);
|
|
1259
|
+
}), t(di, () => y), t(Nt, () => {
|
|
1260
|
+
const k = n(V), { width: P, height: U } = n(Ue), O = Math.abs(k.projectionMatrix.elements[0]) * 0.5 * P, W = Math.abs(k.projectionMatrix.elements[5]) * 0.5 * U, se = n(di);
|
|
1276
1261
|
se.uniforms[Oi].value.set(O, W), se.uniformsNeedUpdate = !0, n(N);
|
|
1277
|
-
}), t(
|
|
1278
|
-
const { width:
|
|
1279
|
-
y.uniforms[ht].value.set(
|
|
1280
|
-
}), t(pi, (
|
|
1281
|
-
y.uniforms[
|
|
1282
|
-
}), t(nt, (
|
|
1262
|
+
}), t(Xt, () => {
|
|
1263
|
+
const { width: k, height: P } = n(Ue);
|
|
1264
|
+
y.uniforms[ht].value.set(k, P), y.uniformsNeedUpdate = !0, n(N);
|
|
1265
|
+
}), t(pi, (k) => {
|
|
1266
|
+
y.uniforms[Fi].value = k, y.uniformsNeedUpdate = !0, n(N);
|
|
1267
|
+
}), t(nt, (k) => {
|
|
1283
1268
|
const P = n(_);
|
|
1284
|
-
|
|
1285
|
-
}), t(fi, (
|
|
1286
|
-
y.uniforms[Di].value =
|
|
1269
|
+
k === void 0 && (k = !P.pointcloudMode), y.uniforms[Ri].value = k ? 1 : 0, y.uniformsNeedUpdate = !0, P.pointcloudMode = k, n(N), P.viewerEvents && (P.viewerEvents.fire(_).pointcloudMode = k);
|
|
1270
|
+
}), t(fi, (k) => {
|
|
1271
|
+
y.uniforms[Di].value = k ? 1 : 0, y.uniformsNeedUpdate = !0;
|
|
1287
1272
|
const P = n(_);
|
|
1288
|
-
P.bigSceneMode =
|
|
1289
|
-
}), t(rt, (
|
|
1290
|
-
y.uniforms[Pi].value =
|
|
1273
|
+
P.bigSceneMode = k, n(N);
|
|
1274
|
+
}), t(rt, (k) => {
|
|
1275
|
+
y.uniforms[Pi].value = k, y.uniformsNeedUpdate = !0;
|
|
1291
1276
|
const P = n(_);
|
|
1292
|
-
P.lightFactor =
|
|
1277
|
+
P.lightFactor = k, n(N);
|
|
1293
1278
|
});
|
|
1294
|
-
let
|
|
1295
|
-
return t(ms, (
|
|
1296
|
-
n(ee) ||
|
|
1297
|
-
}), t(
|
|
1298
|
-
y.uniforms[ki].value =
|
|
1299
|
-
}), t($t, (
|
|
1300
|
-
y.uniforms[Ei].value =
|
|
1301
|
-
}), t(
|
|
1302
|
-
y.uniforms[Bi].value = [
|
|
1303
|
-
}), t(
|
|
1304
|
-
y.uniforms[Ii].value =
|
|
1305
|
-
}), t(ys, (
|
|
1306
|
-
y.uniforms[_i].value =
|
|
1307
|
-
}), t(Ea, (
|
|
1308
|
-
y.uniforms[Li].value =
|
|
1309
|
-
}), t(Fn, async (
|
|
1310
|
-
if (n(ee))
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
E < 0 && (E = 0), E > P && (E = P), r = E, y.uniforms[Ui].value = E, y.uniformsNeedUpdate = !0, n(oe, { shDegree: `${E} / max ${P}` }), n(N);
|
|
1279
|
+
let F = !1;
|
|
1280
|
+
return t(ms, (k) => {
|
|
1281
|
+
n(ee) || F || (F = !0, y.uniforms[zi].value = k, y.uniformsNeedUpdate = !0, n(N));
|
|
1282
|
+
}), t(gt, (k) => {
|
|
1283
|
+
y.uniforms[ki].value = k, y.uniformsNeedUpdate = !0, n(N);
|
|
1284
|
+
}), t($t, (k) => {
|
|
1285
|
+
y.uniforms[Ei].value = k, y.uniformsNeedUpdate = !0, n(N);
|
|
1286
|
+
}), t(Ct, (k, P, U, O) => {
|
|
1287
|
+
y.uniforms[Bi].value = [k, P, U, O ? 1 : -1], y.uniformsNeedUpdate = !0, n(N);
|
|
1288
|
+
}), t(hn, (k = !0) => {
|
|
1289
|
+
y.uniforms[Ii].value = k ? 1 : 0, y.uniformsNeedUpdate = !0, n(N);
|
|
1290
|
+
}), t(ys, (k) => {
|
|
1291
|
+
y.uniforms[_i].value = k, y.uniformsNeedUpdate = !0;
|
|
1292
|
+
}), t(Ea, (k) => {
|
|
1293
|
+
y.uniforms[Li].value = k, y.uniformsNeedUpdate = !0;
|
|
1294
|
+
}), t(Fn, async (k) => {
|
|
1295
|
+
if (n(ee)) return;
|
|
1296
|
+
const P = await n(Gn);
|
|
1297
|
+
k < 0 && (k = 0), k > P && (k = P), r = k, y.uniforms[Ui].value = k, y.uniformsNeedUpdate = !0, n(oe, { shDegree: `${k} / max ${P}` }), n(N);
|
|
1314
1298
|
}), t(mi, () => {
|
|
1315
|
-
y.dispose(), m && m.dispose(),
|
|
1299
|
+
y.dispose(), m && m.dispose(), v && v.dispose(), I && I.dispose(), E && E.dispose();
|
|
1316
1300
|
}), y;
|
|
1317
1301
|
}), t(gs, async () => {
|
|
1318
|
-
const
|
|
1319
|
-
return n(
|
|
1302
|
+
const l = new te(await n(ci), await n(li));
|
|
1303
|
+
return n(Nt), n(Xt), n(fi, n(ee)), n(nt, n(pn)), l;
|
|
1320
1304
|
});
|
|
1321
1305
|
function c() {
|
|
1322
|
-
n(
|
|
1306
|
+
n(Nt), n(Xt);
|
|
1323
1307
|
}
|
|
1324
1308
|
window.addEventListener("resize", c), t(xs, () => {
|
|
1325
1309
|
e = !0, window.removeEventListener("resize", c), n(gi), n(mi);
|
|
1326
1310
|
}), t(Cs, async () => {
|
|
1327
|
-
if (n(ee))
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
return;
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1311
|
+
if (n(ee)) return;
|
|
1312
|
+
let l = 0.01, h = 0.01, f = !1, p = 0;
|
|
1313
|
+
n(gt, h), n(
|
|
1314
|
+
at,
|
|
1315
|
+
() => {
|
|
1316
|
+
if (e || o <= h) return;
|
|
1317
|
+
h += (o - h) * l, n(gt, h);
|
|
1318
|
+
let y = n(Es);
|
|
1319
|
+
y && !p && (p = Date.now());
|
|
1320
|
+
let g = h / a;
|
|
1321
|
+
y && (g > 0.9 || Date.now() - p > 2500) ? (n(pn) && n(fn, !0), n(gt, 0), f = !0) : y && g > 0.7 ? l = Math.min(l * 1.2, 0.3) : y && g > 0.5 ? l = Math.min(l * 1.2, 0.2) : g > 0.4 && (l = Math.min(l * 1.05, 0.1));
|
|
1322
|
+
},
|
|
1323
|
+
() => !e && !f,
|
|
1324
|
+
3
|
|
1325
|
+
);
|
|
1326
|
+
}), t(fn, (l = !1) => {
|
|
1327
|
+
if (n(ee)) return;
|
|
1328
|
+
for (; s.length; ) s.pop().stop = !0;
|
|
1344
1329
|
const h = n(_), f = a * 1e-3;
|
|
1345
1330
|
let p = { currentPointMode: h.pointcloudMode, stepRate: 15e-4, currentLightRadius: f, stop: !1 };
|
|
1346
|
-
s.push(p), n(
|
|
1347
|
-
|
|
1348
|
-
|
|
1331
|
+
s.push(p), n(
|
|
1332
|
+
at,
|
|
1333
|
+
() => {
|
|
1334
|
+
e || (p.currentLightRadius += a * p.stepRate, n($t, p.currentLightRadius), p.currentLightRadius > a ? (n(nt, !p.currentPointMode), n($t, 0), p.stop = !0, s.length === 1 && s[0] === p && s.pop(), l && n(_)?.viewerEvents?.fire(dt), n(_)?.viewerEvents?.fire(Us)) : p.currentLightRadius / a < 0.4 ? p.stepRate = Math.min(p.stepRate * 1.02, 0.03) : p.stepRate *= 1.04);
|
|
1335
|
+
},
|
|
1336
|
+
() => !e && !p.stop
|
|
1337
|
+
);
|
|
1349
1338
|
}), t(ri, () => ({
|
|
1339
|
+
[en]: { type: "t", value: null },
|
|
1350
1340
|
[tn]: { type: "t", value: null },
|
|
1351
|
-
[
|
|
1341
|
+
[qt]: { type: "t", value: null },
|
|
1352
1342
|
[Jt]: { type: "t", value: null },
|
|
1353
|
-
[en]: { type: "t", value: null },
|
|
1354
1343
|
[Oi]: { type: "v2", value: new j() },
|
|
1355
1344
|
[ht]: { type: "v2", value: new j() },
|
|
1356
|
-
[Ri]: { type: "int", value: 0 },
|
|
1357
1345
|
[Fi]: { type: "int", value: 0 },
|
|
1346
|
+
[Ri]: { type: "int", value: 0 },
|
|
1358
1347
|
[Li]: { type: "int", value: 1 },
|
|
1359
1348
|
[Di]: { type: "int", value: 0 },
|
|
1360
1349
|
[Ui]: { type: "int", value: 0 },
|
|
@@ -1362,78 +1351,79 @@ function Ho(i) {
|
|
|
1362
1351
|
[zi]: { type: "float", value: 0 },
|
|
1363
1352
|
[ki]: { type: "float", value: 0 },
|
|
1364
1353
|
[Ei]: { type: "float", value: 0 },
|
|
1365
|
-
[Bi]: { type: "v4", value: new
|
|
1354
|
+
[Bi]: { type: "v4", value: new ve(0, 0, 0, -1) },
|
|
1366
1355
|
[_i]: { type: "float", value: performance.now() },
|
|
1367
|
-
[
|
|
1356
|
+
[vo]: { type: "v4", value: new ve(1, 1, 0, 0.5) },
|
|
1368
1357
|
[Ii]: { type: "int", value: 1 }
|
|
1369
1358
|
}));
|
|
1370
1359
|
const u = n(cs);
|
|
1371
|
-
u.onmessage = (
|
|
1372
|
-
const h =
|
|
1360
|
+
u.onmessage = (l) => {
|
|
1361
|
+
const h = l.data;
|
|
1373
1362
|
h[Qi] && n(ui, h[Qi], h[Hi], h[ko], h[To], h[Wi]);
|
|
1374
|
-
}, t(zs, (
|
|
1375
|
-
n(ee) || (o = h, a = f), n(hi,
|
|
1363
|
+
}, t(zs, (l, h, f) => {
|
|
1364
|
+
n(ee) || (o = h, a = f), n(hi, l);
|
|
1376
1365
|
});
|
|
1377
|
-
function l
|
|
1378
|
-
const h =
|
|
1379
|
-
u.postMessage(
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1366
|
+
function d(l) {
|
|
1367
|
+
const h = l.xyz.slice(0);
|
|
1368
|
+
u.postMessage(
|
|
1369
|
+
{
|
|
1370
|
+
[Eo]: !0,
|
|
1371
|
+
[Po]: h,
|
|
1372
|
+
[Qo]: l.watermarkCount,
|
|
1373
|
+
[Hi]: l.index,
|
|
1374
|
+
[xo]: l.version,
|
|
1375
|
+
[Wi]: l.renderSplatCount,
|
|
1376
|
+
[Co]: l.visibleSplatCount,
|
|
1377
|
+
[Mo]: l.modelSplatCount,
|
|
1378
|
+
[Lo]: l.minX,
|
|
1379
|
+
[Fo]: l.maxX,
|
|
1380
|
+
[Ro]: l.minY,
|
|
1381
|
+
[Bo]: l.maxY,
|
|
1382
|
+
[Uo]: l.minZ,
|
|
1383
|
+
[Oo]: l.maxZ
|
|
1384
|
+
},
|
|
1385
|
+
[h.buffer]
|
|
1386
|
+
);
|
|
1395
1387
|
}
|
|
1396
1388
|
}
|
|
1397
1389
|
function Wo(i) {
|
|
1398
|
-
const e = (a, ...o) => i.fire(a, ...o), t = (a, o, s) => i.on(a, o, s), n = new Set(
|
|
1399
|
-
t(
|
|
1390
|
+
const e = (a, ...o) => i.fire(a, ...o), t = (a, o, s) => i.on(a, o, s), n = new Set(Ka.split(""));
|
|
1391
|
+
t(Rs, async (a = "", o = !0, s = !0) => {
|
|
1400
1392
|
const r = a.trim().substring(0, 100);
|
|
1401
1393
|
let c = await e(os, r), u = [];
|
|
1402
1394
|
for (let b = 0; b < c.length; b++) {
|
|
1403
|
-
let
|
|
1395
|
+
let v = [], T = c[b];
|
|
1404
1396
|
for (let w = 0; w < T.length; w++)
|
|
1405
|
-
|
|
1406
|
-
u.push(
|
|
1397
|
+
v.push([(T[w] % 20 - 10) * 0.02, ((T[w] / 20 | 0) - 10) * 0.02]);
|
|
1398
|
+
u.push(v);
|
|
1407
1399
|
}
|
|
1408
|
-
let
|
|
1409
|
-
for (let b = 0; b <
|
|
1410
|
-
|
|
1411
|
-
let h =
|
|
1400
|
+
let d = [], l = r.split("");
|
|
1401
|
+
for (let b = 0; b < l.length; b++)
|
|
1402
|
+
d[b] = n.has(l[b]) ? 0.22 : 0.4;
|
|
1403
|
+
let h = l.length / 2 | 0, f = d[h] / 2, p = !(l.length % 2), y = p ? 0 : -f;
|
|
1412
1404
|
for (let b = h - 1; b >= 0; b--) {
|
|
1413
|
-
y -=
|
|
1414
|
-
for (let
|
|
1415
|
-
|
|
1416
|
-
y -= l[b] / 2;
|
|
1405
|
+
y -= d[b] / 2;
|
|
1406
|
+
for (let v of u[b]) v[0] += y;
|
|
1407
|
+
y -= d[b] / 2;
|
|
1417
1408
|
}
|
|
1418
|
-
f =
|
|
1409
|
+
f = d[h] / 2, y = p ? 0 : f;
|
|
1419
1410
|
for (let b = u.length - h; b < u.length; b++) {
|
|
1420
|
-
y +=
|
|
1421
|
-
for (let
|
|
1422
|
-
|
|
1423
|
-
y += l[b] / 2;
|
|
1411
|
+
y += d[b] / 2;
|
|
1412
|
+
for (let v of u[b]) v[0] += y;
|
|
1413
|
+
y += d[b] / 2;
|
|
1424
1414
|
}
|
|
1425
1415
|
let g = 0;
|
|
1426
1416
|
for (let b of u)
|
|
1427
1417
|
g += b.length;
|
|
1428
|
-
const m = new Uint8Array(g *
|
|
1418
|
+
const m = new Uint8Array(g * R);
|
|
1429
1419
|
let x = 0;
|
|
1430
1420
|
for (let b of u)
|
|
1431
|
-
for (let
|
|
1432
|
-
m.set(await ao(
|
|
1421
|
+
for (let v of b)
|
|
1422
|
+
m.set(await ao(v[0], v[1], o, s), R * x++);
|
|
1433
1423
|
return m;
|
|
1434
1424
|
});
|
|
1435
1425
|
}
|
|
1436
|
-
function
|
|
1426
|
+
function qn(i) {
|
|
1437
1427
|
const e = (t, n, a) => i.on(t, n, a);
|
|
1438
1428
|
e(Pe, (t) => {
|
|
1439
1429
|
t.url;
|
|
@@ -1443,7 +1433,7 @@ function Jn(i) {
|
|
|
1443
1433
|
console.info(a);
|
|
1444
1434
|
}), e(os, (t = "") => {
|
|
1445
1435
|
const n = "https://reall3d.com/gsfont/api/getGaussianText", a = new FormData();
|
|
1446
|
-
return a.append("text", t.substring(0, 100)), a.append("ver",
|
|
1436
|
+
return a.append("text", t.substring(0, 100)), a.append("ver", Yt), new Promise((o) => {
|
|
1447
1437
|
fetch(n, { method: "POST", body: a }).then((s) => s.ok ? s.json() : {}).then((s) => s.success ? o(JSON.parse(s.data)) : o([])).catch((s) => o([]));
|
|
1448
1438
|
});
|
|
1449
1439
|
});
|
|
@@ -1453,23 +1443,31 @@ function Yo(i) {
|
|
|
1453
1443
|
const t = (r, c, u) => i.on(r, c, u), n = (r, ...c) => i.fire(r, ...c);
|
|
1454
1444
|
t(As, () => e = !0);
|
|
1455
1445
|
const a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1456
|
-
t(
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1446
|
+
t(It, () => n(re) && a.set(Date.now(), 1)), t(Dt, () => n(re) && n(Ye, a)), t(Pt, () => n(re) && o.set(Date.now(), 1)), t(Lt, () => n(re) && n(Ye, o)), t(
|
|
1447
|
+
Oe,
|
|
1448
|
+
() => {
|
|
1449
|
+
e || (n(Pt), n(re) && n(oe, {
|
|
1450
|
+
fov: n(ft),
|
|
1451
|
+
position: n(Le, n(Be)),
|
|
1452
|
+
lookAt: n(Le, n(Ce)),
|
|
1453
|
+
lookUp: n(Le, n(Ne))
|
|
1454
|
+
}));
|
|
1455
|
+
},
|
|
1456
|
+
!0
|
|
1457
|
+
);
|
|
1464
1458
|
let s = 0;
|
|
1465
|
-
t(
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1459
|
+
t(
|
|
1460
|
+
Ve,
|
|
1461
|
+
() => {
|
|
1462
|
+
e || (n(ds), n(re) && (n(It), !(s++ % 5) && n(oe, { fps: n(Dt), realFps: n(Lt) })));
|
|
1463
|
+
},
|
|
1464
|
+
!0
|
|
1465
|
+
), t(Ye, (r) => {
|
|
1466
|
+
let c = [], u = Date.now(), d = 0;
|
|
1467
|
+
for (const l of r.keys())
|
|
1468
|
+
u - l <= 1e3 ? d++ : c.push(l);
|
|
1469
|
+
return c.forEach((l) => r.delete(l)), Math.min(d, 30);
|
|
1470
|
+
}), window.addEventListener("beforeunload", () => n(Ht));
|
|
1473
1471
|
}
|
|
1474
1472
|
function Vo(i) {
|
|
1475
1473
|
const e = { ...i };
|
|
@@ -1498,7 +1496,7 @@ function Xo(i) {
|
|
|
1498
1496
|
const { renderer: e, scene: t } = i, n = { renderer: e, scene: t };
|
|
1499
1497
|
return n.viewerEvents = i.viewerEvents, n.debugMode = i.debugMode, n.renderer = i.renderer, n.scene = i.scene, n.controls = i.controls, n.bigSceneMode = i.bigSceneMode, n.pointcloudMode = i.pointcloudMode, n.maxRenderCountOfMobile = i.maxRenderCountOfMobile, n.maxRenderCountOfPc = i.maxRenderCountOfPc, n.lightFactor = i.lightFactor, n.shDegree = i.shDegree, n;
|
|
1500
1498
|
}
|
|
1501
|
-
function
|
|
1499
|
+
function $o(i) {
|
|
1502
1500
|
const e = (s, r, c) => i.on(s, r, c), t = (s, ...r) => i.fire(s, ...r), n = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2xldCBpPTA7aSsrO2NvbnN0IEQ9YCQke2krK31gO2krKyxpKyssaSsrO2NvbnN0IFc9YCQke2krK31gLHA9YCQke2krK31gLFM9YCQke2krK31gLHk9YCQke2krK31gLEM9YCQke2krK31gLEE9YCQke2krK31gLFI9YCQke2krK31gLEc9YCQke2krK31gO2krKztjb25zdCBIPWAkJHtpKyt9YCxKPWAkJHtpKyt9YDtpKys7Y29uc3QgVD1gJCR7aSsrfWA7aSsrO2NvbnN0IEs9YCQke2krK31gO2krKztjb25zdCBMPWAkJHtpKyt9YCxOPWAkJHtpKyt9YCxPPWAkJHtpKyt9YCxRPWAkJHtpKyt9YCxfPWAkJHtpKyt9YCxWPWAkJHtpKyt9YCxqPWAkJHtpKyt9YCxQPWAkJHtpKyt9YDtpKys7Y29uc3Qgbm49bmF2aWdhdG9yLnVzZXJBZ2VudC5pbmNsdWRlcygiTW9iaSIpLGI9c2VsZjtsZXQgWD17aW5kZXg6MCx2ZXJzaW9uOjB9LFk9e2luZGV4OjEsdmVyc2lvbjowfSx3PSExLFo7Y29uc3QgdG49LjI7bGV0IGssZj1bXSxNLHo9MCxCO2Z1bmN0aW9uIGFuKG4pe2lmKCF3KXJldHVybjtsZXQgYT1YLnZlcnNpb24+WS52ZXJzaW9uP1g6WTtpZighYS52ZXJzaW9uKXJldHVybjtjb25zdHt4eXo6dCxyZW5kZXJTcGxhdENvdW50Om8sdmlzaWJsZVNwbGF0Q291bnQ6bSxtb2RlbFNwbGF0Q291bnQ6RSx3YXRlcm1hcmtDb3VudDp4LGluZGV4OkYsdmVyc2lvbjp1fT1hO2lmKHo9PT11JiZNYXRoLmFicyhmWzJdLW5bMl0pK01hdGguYWJzKGZbNl0tbls2XSkrTWF0aC5hYnMoZlsxMF0tblsxMF0pK01hdGguYWJzKGZbMTRdLW5bMTRdKTx0bilyZXR1cm47Zj1uLHo9dTtsZXQgST1EYXRlLm5vdygpLGw7aWYoIW8pe2w9bmV3IFVpbnQzMkFycmF5KDApLGIucG9zdE1lc3NhZ2Uoe1tEXTpsLFtTXTpvLFt5XTptLFtDXTpFLFtXXTpGLFtwXTp1LFtSXTowLFtBXTpJfSxbbC5idWZmZXJdKTtyZXR1cm59bGV0IHE9MDtjb25zdCByPW8teDtsPW5ldyBVaW50MzJBcnJheShvKTtjb25zdHttYXhEZXB0aDp2LG1pbkRlcHRoOmR9PWVuKGEsayk7aWYodi1kPD0xZS01KWZvcihsZXQgcz0wO3M8bztzKyspbFtzXT1zO2Vsc2V7bGV0IHM9TWF0aC5taW4ociw2NTUzNSksZz0ocy0xKS8odi1kKSxjPW5ldyBJbnQzMkFycmF5KHMpO2ZvcihsZXQgZT0wLGg9MDtlPHI7ZSsrKWg9KCQobix0WzMqZV0sdFszKmUrMV0sdFszKmUrMl0pLWQpKmd8MCxjW01bZV09aF0rKztmb3IobGV0IGU9MTtlPHM7ZSsrKWNbZV0rPWNbZS0xXTtmb3IobGV0IGU9MDtlPHI7ZSsrKWxbLS1jW01bZV1dXT1lO2lmKHgpe3M9TWF0aC5taW4oTWF0aC5tYXgoeC84fDAsNTEyKSw2NTUzNSksZz0ocy0xKS8odi1kKSxjPW5ldyBJbnQzMkFycmF5KHMpO2ZvcihsZXQgZT1yLGg9MDtlPG87ZSsrKWg9KCQobix0WzMqZV0sdFszKmUrMV0sdFszKmUrMl0pLWQpKmd8MCxjW01bZS1yXT1oXSsrO2ZvcihsZXQgZT0xO2U8cztlKyspY1tlXSs9Y1tlLTFdO2ZvcihsZXQgZT0wO2U8eDtlKyspbFtyKy0tY1tNW2VdXV09citlfX1xPURhdGUubm93KCktSSxiLnBvc3RNZXNzYWdlKHtbRF06bCxbU106byxbeV06bSxbQ106RSxbV106RixbcF06dSxbQV06SSxbUl06cX0sW2wuYnVmZmVyXSl9ZnVuY3Rpb24gJChuLGEsdCxvKXtyZXR1cm4tKG5bMl0qYStuWzZdKnQrblsxMF0qbyl9ZnVuY3Rpb24gZW4obixhKXtsZXQgdD0tMS8wLG89MS8wLG09MDtyZXR1cm4gbT0kKGEsbi5taW5YLG4ubWluWSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5taW5YLG4ubWluWSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5taW5YLG4ubWF4WSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5taW5YLG4ubWF4WSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWluWSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWluWSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWF4WSxuLm1pblopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSksbT0kKGEsbi5tYXhYLG4ubWF4WSxuLm1heFopLHQ9TWF0aC5tYXgodCxtKSxvPU1hdGgubWluKG8sbSkse21heERlcHRoOnQsbWluRGVwdGg6b319Y29uc3QgVT0oKT0+e2lmKCFaKXtaPSEwO2NvbnN0IG49azthbihuKSxzZXRUaW1lb3V0KCgpPT4hKFo9ITEpJiZuIT09ayYmVSgpKX19O2Iub25tZXNzYWdlPW49Pntjb25zdCBhPW4uZGF0YTtpZihhW0ddKXtsZXQgdD0hQnx8YVtXXT09PTA/WDpZO3QubWluWD1hW0xdLHQubWF4WD1hW05dLHQubWluWT1hW09dLHQubWF4WT1hW1FdLHQubWluWj1hW19dLHQubWF4Wj1hW1ZdLHQueHl6PW5ldyBGbG9hdDMyQXJyYXkoYVtLXS5idWZmZXIpLHQud2F0ZXJtYXJrQ291bnQ9YVtQXSx0LnZlcnNpb249YVtwXSx0LnJlbmRlclNwbGF0Q291bnQ9YVtTXSx0LnZpc2libGVTcGxhdENvdW50PWFbeV0sdC5tb2RlbFNwbGF0Q291bnQ9YVtDXSx0LnRleHR1cmVSZWFkeT0hMCx0LnRleHR1cmVSZWFkeVRpbWU9RGF0ZS5ub3coKX1lbHNlIGFbVF0/KGs9YVtUXSxVKCkpOmFbal0mJihCPWFbSF0sTT1uZXcgSW50MzJBcnJheShhW0pdKSx3PSEwKX19KSgpOwo=", a = URL.createObjectURL(new Blob([atob(n)], { type: "text/javascript" })), o = new Worker(new URL(a, import.meta.url), { type: "module" });
|
|
1503
1501
|
e(cs, () => o), e(ps, () => o.postMessage({ [Do]: t(hs) })), e(fs, () => o.terminate()), (async () => o.postMessage({ [zo]: !0, [Io]: await t(ot), [_o]: t(ee) }))();
|
|
1504
1502
|
}
|
|
@@ -1509,11 +1507,11 @@ class pe extends te {
|
|
|
1509
1507
|
*/
|
|
1510
1508
|
constructor(e) {
|
|
1511
1509
|
super(), this.isSplatMesh = !0, this.disposed = !1;
|
|
1512
|
-
const t = new
|
|
1513
|
-
n(_, () => o), n(
|
|
1510
|
+
const t = new Nn(), n = (r, c, u) => t.on(r, c, u), a = (r, ...c) => t.fire(r, ...c), o = Vo(e), s = o.controls.object;
|
|
1511
|
+
n(_, () => o), n(Ke, () => o.renderer.domElement), n(V, () => s), n(ft, () => s.fov), n(Be, (r = !1) => r ? s.position.clone() : s.position), n(Ce, (r = !1) => r ? o.controls.target.clone() : o.controls.target), n(hs, () => s.projectionMatrix.clone().multiply(s.matrixWorldInverse).multiply(this.matrix).toArray()), n(Ca, () => s.projectionMatrix.clone().multiply(s.matrixWorldInverse)), n(Qa, () => s.getWorldDirection(new C()).toArray()), n(ct, () => o.renderer), n(B, () => o.scene), n(ee, () => o.bigSceneMode), n(pn, () => o.pointcloudMode), n(ye, () => this), n(N, () => o.viewerEvents?.fire(J)), jn(t), qn(t), go(t), $o(t), Ho(t), Wo(t), this.name = `${o.name || this.id}`, this.events = t, this.opts = o, (async () => (this.copy(await t.fire(gs)), o.matrix && this.applyMatrix4(o.matrix), this.frustumCulled = !1, this.onBeforeRender = () => {
|
|
1514
1512
|
a(ps), a(ys, performance.now());
|
|
1515
1513
|
}, this.onAfterRender = () => {
|
|
1516
|
-
a(
|
|
1514
|
+
a(Ss, 1e4) && a(N);
|
|
1517
1515
|
}))();
|
|
1518
1516
|
}
|
|
1519
1517
|
/**
|
|
@@ -1522,8 +1520,7 @@ class pe extends te {
|
|
|
1522
1520
|
* @returns 最新配置项
|
|
1523
1521
|
*/
|
|
1524
1522
|
options(e) {
|
|
1525
|
-
if (this.disposed)
|
|
1526
|
-
return;
|
|
1523
|
+
if (this.disposed) return;
|
|
1527
1524
|
const t = (a, ...o) => this.events.fire(a, ...o), n = this.opts;
|
|
1528
1525
|
return e && (e.pointcloudMode !== void 0 && t(nt, e.pointcloudMode), e.lightFactor !== void 0 && t(rt, e.lightFactor), e.maxRenderCountOfMobile !== void 0 && (n.maxRenderCountOfMobile = e.maxRenderCountOfMobile), e.maxRenderCountOfPc !== void 0 && (n.maxRenderCountOfPc = e.maxRenderCountOfPc), t(N)), { ...n };
|
|
1529
1526
|
}
|
|
@@ -1533,7 +1530,7 @@ class pe extends te {
|
|
|
1533
1530
|
* @param meta 元数据
|
|
1534
1531
|
*/
|
|
1535
1532
|
async addModel(e, t) {
|
|
1536
|
-
this.disposed || (this.meta = t, await this.events.fire(
|
|
1533
|
+
this.disposed || (this.meta = t, await this.events.fire(vs, e, t));
|
|
1537
1534
|
}
|
|
1538
1535
|
fire(e, ...t) {
|
|
1539
1536
|
if (!this.disposed)
|
|
@@ -1543,24 +1540,23 @@ class pe extends te {
|
|
|
1543
1540
|
* 销毁
|
|
1544
1541
|
*/
|
|
1545
1542
|
dispose() {
|
|
1546
|
-
if (this.disposed)
|
|
1547
|
-
return;
|
|
1543
|
+
if (this.disposed) return;
|
|
1548
1544
|
this.disposed = !0;
|
|
1549
1545
|
const e = (t, ...n) => this.events.fire(t, ...n);
|
|
1550
|
-
e(ke, this), e(B).remove(this), e(
|
|
1546
|
+
e(ke, this), e(B).remove(this), e(Rn), e(bs), e(fs), e(xs), this.events.clear(), this.events = null, this.opts = null, this.onAfterRender = null;
|
|
1551
1547
|
}
|
|
1552
1548
|
}
|
|
1553
|
-
class
|
|
1549
|
+
class Ko extends In {
|
|
1554
1550
|
constructor(e = new C(0, 0, 1), t = new C(0, 0, 0), n = 1, a = 0.1, o = 16776960, s = n * 0.2, r = s * 0.2) {
|
|
1555
1551
|
super(), this._axis = new C(), this.type = "ArrowHelper";
|
|
1556
|
-
const c = new
|
|
1552
|
+
const c = new ei(a, a, n, 32);
|
|
1557
1553
|
c.translate(0, n / 2, 0);
|
|
1558
|
-
const u = new
|
|
1554
|
+
const u = new ei(0, r, s, 32);
|
|
1559
1555
|
u.translate(0, n, 0), this.position.copy(t);
|
|
1560
|
-
const l = new xe({ color: o, toneMapped: !1 });
|
|
1561
|
-
l.side = we, this.line = new te(c, l), this.line.matrixAutoUpdate = !1, this.line.ignoreIntersect = !0, this.add(this.line);
|
|
1562
1556
|
const d = new xe({ color: o, toneMapped: !1 });
|
|
1563
|
-
d.side = we, this.
|
|
1557
|
+
d.side = we, this.line = new te(c, d), this.line.matrixAutoUpdate = !1, this.line.ignoreIntersect = !0, this.add(this.line);
|
|
1558
|
+
const l = new xe({ color: o, toneMapped: !1 });
|
|
1559
|
+
l.side = we, this.cone = new te(u, l), this.cone.matrixAutoUpdate = !1, this.cone.ignoreIntersect = !0, this.add(this.cone), this.setDirection(e), this.renderOrder = 99999;
|
|
1564
1560
|
}
|
|
1565
1561
|
setDirection(e) {
|
|
1566
1562
|
if (e.y > 0.99999)
|
|
@@ -1592,17 +1588,17 @@ function Zo(i) {
|
|
|
1592
1588
|
o.ignoreIntersect = !0;
|
|
1593
1589
|
const s = new C(0, -1, 0);
|
|
1594
1590
|
s.normalize();
|
|
1595
|
-
const r = new C(0, 0, 0), c = 0.5, u = 0.01,
|
|
1596
|
-
p.add(o), p.add(f), p.renderOrder = 99999, o.renderOrder = 99999, p.visible = !1, t(B).add(p), e(La, () => p), e(
|
|
1597
|
-
t(
|
|
1598
|
-
}), e(
|
|
1591
|
+
const r = new C(0, 0, 0), c = 0.5, u = 0.01, d = 16777062, l = 0.1, h = 0.03, f = new Ko(s, r, c, u, d, l, h), p = new In();
|
|
1592
|
+
p.add(o), p.add(f), p.renderOrder = 99999, o.renderOrder = 99999, p.visible = !1, t(B).add(p), e(La, () => p), e(Tt, (y) => {
|
|
1593
|
+
t(Rt, !0), p.visible = y === void 0 ? !p.visible : y, t(J);
|
|
1594
|
+
}), e(Un, () => p.visible), e(Rt, (y = !1) => {
|
|
1599
1595
|
if (y || p.visible) {
|
|
1600
|
-
const g = new
|
|
1596
|
+
const g = new _t(), m = new C(0, -1, 0);
|
|
1601
1597
|
g.setFromUnitVectors(m, t(Ne)), p.position.copy(t(Ce)), p.quaternion.copy(g);
|
|
1602
1598
|
}
|
|
1603
1599
|
});
|
|
1604
1600
|
}
|
|
1605
|
-
const Vi = { type: "change" },
|
|
1601
|
+
const Vi = { type: "change" }, Jn = { type: "start" }, ea = { type: "end" }, At = new pa(), Gi = new fa(), jo = Math.cos(70 * be.DEG2RAD), G = new C(), ae = 2 * Math.PI, H = {
|
|
1606
1602
|
NONE: -1,
|
|
1607
1603
|
ROTATE: 0,
|
|
1608
1604
|
DOLLY: 1,
|
|
@@ -1611,10 +1607,10 @@ const Vi = { type: "change" }, ei = { type: "start" }, ea = { type: "end" }, wt
|
|
|
1611
1607
|
TOUCH_PAN: 4,
|
|
1612
1608
|
TOUCH_DOLLY_PAN: 5,
|
|
1613
1609
|
TOUCH_DOLLY_ROTATE: 6
|
|
1614
|
-
},
|
|
1610
|
+
}, nn = 1e-6;
|
|
1615
1611
|
class ta extends ha {
|
|
1616
1612
|
constructor(e, t = null) {
|
|
1617
|
-
super(e, t), this.state = H.NONE, this.enabled = !0, this.target = new C(), this.cursor = new C(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Ae.ROTATE, MIDDLE: Ae.DOLLY, RIGHT: Ae.PAN }, this.touches = { ONE:
|
|
1613
|
+
super(e, t), this.state = H.NONE, this.enabled = !0, this.target = new C(), this.cursor = new C(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Ae.ROTATE, MIDDLE: Ae.DOLLY, RIGHT: Ae.PAN }, this.touches = { ONE: Se.ROTATE, TWO: Se.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new C(), this._lastQuaternion = new _t(), this._lastTargetPosition = new C(), this._quat = new _t().setFromUnitVectors(e.up, new C(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ti(), this._sphericalDelta = new ti(), this._scale = 1, this._panOffset = new C(), this._rotateStart = new j(), this._rotateEnd = new j(), this._rotateDelta = new j(), this._panStart = new j(), this._panEnd = new j(), this._panDelta = new j(), this._dollyStart = new j(), this._dollyEnd = new j(), this._dollyDelta = new j(), this._dollyDirection = new C(), this._mouse = new j(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Jo.bind(this), this._onPointerDown = qo.bind(this), this._onPointerUp = er.bind(this), this._onContextMenu = rr.bind(this), this._onMouseWheel = ir.bind(this), this._onKeyDown = sr.bind(this), this._onTouchStart = ar.bind(this), this._onTouchMove = or.bind(this), this._onMouseDown = tr.bind(this), this._onMouseMove = nr.bind(this), this._interceptControlDown = cr.bind(this), this._interceptControlUp = lr.bind(this), this.domElement !== null && this.connect(), this.update();
|
|
1618
1614
|
}
|
|
1619
1615
|
connect() {
|
|
1620
1616
|
this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -1674,12 +1670,12 @@ class ta extends ha {
|
|
|
1674
1670
|
u.unproject(this.object), this.object.position.sub(u).add(r), this.object.updateMatrixWorld(), s = G.length();
|
|
1675
1671
|
} else
|
|
1676
1672
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
1677
|
-
s !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position) : (
|
|
1673
|
+
s !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position) : (At.origin.copy(this.object.position), At.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(At.direction)) < jo ? this.object.lookAt(this.target) : (Gi.setFromNormalAndCoplanarPoint(this.object.up, this.target), At.intersectPlane(Gi, this.target))));
|
|
1678
1674
|
} else if (this.object.isOrthographicCamera) {
|
|
1679
1675
|
const s = this.object.zoom;
|
|
1680
1676
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), s !== this.object.zoom && (this.object.updateProjectionMatrix(), o = !0);
|
|
1681
1677
|
}
|
|
1682
|
-
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) >
|
|
1678
|
+
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) > nn || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > nn || this._lastTargetPosition.distanceToSquared(this.target) > nn ? (this.dispatchEvent(Vi), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
1683
1679
|
}
|
|
1684
1680
|
_getAutoRotationAngle(e) {
|
|
1685
1681
|
return e !== null ? ae / 60 * this.autoRotateSpeed * e : ae / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -1929,7 +1925,7 @@ function tr(i) {
|
|
|
1929
1925
|
default:
|
|
1930
1926
|
this.state = H.NONE;
|
|
1931
1927
|
}
|
|
1932
|
-
this.state !== H.NONE && this.dispatchEvent(
|
|
1928
|
+
this.state !== H.NONE && this.dispatchEvent(Jn);
|
|
1933
1929
|
}
|
|
1934
1930
|
function nr(i) {
|
|
1935
1931
|
switch (this.state) {
|
|
@@ -1948,7 +1944,7 @@ function nr(i) {
|
|
|
1948
1944
|
}
|
|
1949
1945
|
}
|
|
1950
1946
|
function ir(i) {
|
|
1951
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== H.NONE || (i.preventDefault(), this.dispatchEvent(
|
|
1947
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== H.NONE || (i.preventDefault(), this.dispatchEvent(Jn), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(ea));
|
|
1952
1948
|
}
|
|
1953
1949
|
function sr(i) {
|
|
1954
1950
|
this.enabled !== !1 && this._handleKeyDown(i);
|
|
@@ -1957,11 +1953,11 @@ function ar(i) {
|
|
|
1957
1953
|
switch (this._trackPointer(i), this._pointers.length) {
|
|
1958
1954
|
case 1:
|
|
1959
1955
|
switch (this.touches.ONE) {
|
|
1960
|
-
case
|
|
1956
|
+
case Se.ROTATE:
|
|
1961
1957
|
if (this.enableRotate === !1) return;
|
|
1962
1958
|
this._handleTouchStartRotate(i), this.state = H.TOUCH_ROTATE;
|
|
1963
1959
|
break;
|
|
1964
|
-
case
|
|
1960
|
+
case Se.PAN:
|
|
1965
1961
|
if (this.enablePan === !1) return;
|
|
1966
1962
|
this._handleTouchStartPan(i), this.state = H.TOUCH_PAN;
|
|
1967
1963
|
break;
|
|
@@ -1971,11 +1967,11 @@ function ar(i) {
|
|
|
1971
1967
|
break;
|
|
1972
1968
|
case 2:
|
|
1973
1969
|
switch (this.touches.TWO) {
|
|
1974
|
-
case
|
|
1970
|
+
case Se.DOLLY_PAN:
|
|
1975
1971
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
1976
1972
|
this._handleTouchStartDollyPan(i), this.state = H.TOUCH_DOLLY_PAN;
|
|
1977
1973
|
break;
|
|
1978
|
-
case
|
|
1974
|
+
case Se.DOLLY_ROTATE:
|
|
1979
1975
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
1980
1976
|
this._handleTouchStartDollyRotate(i), this.state = H.TOUCH_DOLLY_ROTATE;
|
|
1981
1977
|
break;
|
|
@@ -1986,7 +1982,7 @@ function ar(i) {
|
|
|
1986
1982
|
default:
|
|
1987
1983
|
this.state = H.NONE;
|
|
1988
1984
|
}
|
|
1989
|
-
this.state !== H.NONE && this.dispatchEvent(
|
|
1985
|
+
this.state !== H.NONE && this.dispatchEvent(Jn);
|
|
1990
1986
|
}
|
|
1991
1987
|
function or(i) {
|
|
1992
1988
|
switch (this._trackPointer(i), this.state) {
|
|
@@ -2039,15 +2035,15 @@ class dr extends ta {
|
|
|
2039
2035
|
}
|
|
2040
2036
|
class ur extends ta {
|
|
2041
2037
|
constructor(e, t) {
|
|
2042
|
-
super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: Ae.PAN, MIDDLE: Ae.DOLLY, RIGHT: Ae.ROTATE }, this.touches = { ONE:
|
|
2038
|
+
super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: Ae.PAN, MIDDLE: Ae.DOLLY, RIGHT: Ae.ROTATE }, this.touches = { ONE: Se.PAN, TWO: Se.DOLLY_ROTATE };
|
|
2043
2039
|
}
|
|
2044
2040
|
}
|
|
2045
|
-
const Ni = new
|
|
2046
|
-
class na extends
|
|
2041
|
+
const Ni = new Dn(), wt = new C();
|
|
2042
|
+
class na extends rn {
|
|
2047
2043
|
constructor() {
|
|
2048
2044
|
super(), this.isLineSegmentsGeometry = !0, this.type = "LineSegmentsGeometry";
|
|
2049
2045
|
const e = [-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0], t = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2], n = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5];
|
|
2050
|
-
this.setIndex(n), this.setAttribute("position", new
|
|
2046
|
+
this.setIndex(n), this.setAttribute("position", new ni(e, 3)), this.setAttribute("uv", new ni(t, 2));
|
|
2051
2047
|
}
|
|
2052
2048
|
applyMatrix4(e) {
|
|
2053
2049
|
const t = this.attributes.instanceStart, n = this.attributes.instanceEnd;
|
|
@@ -2056,13 +2052,13 @@ class na extends cn {
|
|
|
2056
2052
|
setPositions(e) {
|
|
2057
2053
|
let t;
|
|
2058
2054
|
e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
|
|
2059
|
-
const n = new
|
|
2055
|
+
const n = new cn(t, 6, 1);
|
|
2060
2056
|
return this.setAttribute("instanceStart", new We(n, 3, 0)), this.setAttribute("instanceEnd", new We(n, 3, 3)), this.instanceCount = this.attributes.instanceStart.count, this.computeBoundingBox(), this.computeBoundingSphere(), this;
|
|
2061
2057
|
}
|
|
2062
2058
|
setColors(e) {
|
|
2063
2059
|
let t;
|
|
2064
2060
|
e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
|
|
2065
|
-
const n = new
|
|
2061
|
+
const n = new cn(t, 6, 1);
|
|
2066
2062
|
return this.setAttribute("instanceColorStart", new We(n, 3, 0)), this.setAttribute("instanceColorEnd", new We(n, 3, 3)), this;
|
|
2067
2063
|
}
|
|
2068
2064
|
fromWireframeGeometry(e) {
|
|
@@ -2079,7 +2075,7 @@ class na extends cn {
|
|
|
2079
2075
|
return this.setPositions(t.attributes.position.array), this;
|
|
2080
2076
|
}
|
|
2081
2077
|
computeBoundingBox() {
|
|
2082
|
-
this.boundingBox === null && (this.boundingBox = new
|
|
2078
|
+
this.boundingBox === null && (this.boundingBox = new Dn());
|
|
2083
2079
|
const e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
|
|
2084
2080
|
e !== void 0 && t !== void 0 && (this.boundingBox.setFromBufferAttribute(e), Ni.setFromBufferAttribute(t), this.boundingBox.union(Ni));
|
|
2085
2081
|
}
|
|
@@ -2091,7 +2087,7 @@ class na extends cn {
|
|
|
2091
2087
|
this.boundingBox.getCenter(n);
|
|
2092
2088
|
let a = 0;
|
|
2093
2089
|
for (let o = 0, s = e.count; o < s; o++)
|
|
2094
|
-
|
|
2090
|
+
wt.fromBufferAttribute(e, o), a = Math.max(a, n.distanceToSquared(wt)), wt.fromBufferAttribute(t, o), a = Math.max(a, n.distanceToSquared(wt));
|
|
2095
2091
|
this.boundingSphere.radius = Math.sqrt(a), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this);
|
|
2096
2092
|
}
|
|
2097
2093
|
}
|
|
@@ -2101,7 +2097,7 @@ class na extends cn {
|
|
|
2101
2097
|
return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."), this.applyMatrix4(e);
|
|
2102
2098
|
}
|
|
2103
2099
|
}
|
|
2104
|
-
|
|
2100
|
+
xt.line = {
|
|
2105
2101
|
worldUnits: { value: 1 },
|
|
2106
2102
|
linewidth: { value: 1 },
|
|
2107
2103
|
resolution: { value: new j(1, 1) },
|
|
@@ -2111,11 +2107,11 @@ Ct.line = {
|
|
|
2111
2107
|
gapSize: { value: 1 }
|
|
2112
2108
|
// todo FIX - maybe change to totalSize
|
|
2113
2109
|
};
|
|
2114
|
-
|
|
2110
|
+
bt.line = {
|
|
2115
2111
|
uniforms: ns.merge([
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2112
|
+
xt.common,
|
|
2113
|
+
xt.fog,
|
|
2114
|
+
xt.line
|
|
2119
2115
|
]),
|
|
2120
2116
|
vertexShader: (
|
|
2121
2117
|
/* glsl */
|
|
@@ -2496,13 +2492,13 @@ xt.line = {
|
|
|
2496
2492
|
`
|
|
2497
2493
|
)
|
|
2498
2494
|
};
|
|
2499
|
-
class Xe extends
|
|
2495
|
+
class Xe extends _n {
|
|
2500
2496
|
constructor(e) {
|
|
2501
2497
|
super({
|
|
2502
2498
|
type: "LineMaterial",
|
|
2503
|
-
uniforms: ns.clone(
|
|
2504
|
-
vertexShader:
|
|
2505
|
-
fragmentShader:
|
|
2499
|
+
uniforms: ns.clone(bt.line.uniforms),
|
|
2500
|
+
vertexShader: bt.line.vertexShader,
|
|
2501
|
+
fragmentShader: bt.line.fragmentShader,
|
|
2506
2502
|
clipping: !0
|
|
2507
2503
|
// required for clipping support
|
|
2508
2504
|
}), this.isLineMaterial = !0, this.setValues(e);
|
|
@@ -2574,20 +2570,20 @@ class Xe extends In {
|
|
|
2574
2570
|
this.defines && (e === !0 !== this.alphaToCoverage && (this.needsUpdate = !0), e === !0 ? this.defines.USE_ALPHA_TO_COVERAGE = "" : delete this.defines.USE_ALPHA_TO_COVERAGE);
|
|
2575
2571
|
}
|
|
2576
2572
|
}
|
|
2577
|
-
const
|
|
2578
|
-
let ge,
|
|
2573
|
+
const sn = new ve(), Xi = new C(), $i = new C(), $ = new ve(), K = new ve(), de = new ve(), an = new C(), on = new $e(), Z = new ma(), Ki = new C(), vt = new Dn(), St = new tt(), ue = new ve();
|
|
2574
|
+
let ge, Fe;
|
|
2579
2575
|
function Zi(i, e, t) {
|
|
2580
|
-
return ue.set(0, 0, -e, 1).applyMatrix4(i.projectionMatrix), ue.multiplyScalar(1 / ue.w), ue.x =
|
|
2576
|
+
return ue.set(0, 0, -e, 1).applyMatrix4(i.projectionMatrix), ue.multiplyScalar(1 / ue.w), ue.x = Fe / t.width, ue.y = Fe / t.height, ue.applyMatrix4(i.projectionMatrixInverse), ue.multiplyScalar(1 / ue.w), Math.abs(Math.max(ue.x, ue.y));
|
|
2581
2577
|
}
|
|
2582
2578
|
function hr(i, e) {
|
|
2583
2579
|
const t = i.matrixWorld, n = i.geometry, a = n.attributes.instanceStart, o = n.attributes.instanceEnd, s = Math.min(n.instanceCount, a.count);
|
|
2584
2580
|
for (let r = 0, c = s; r < c; r++) {
|
|
2585
2581
|
Z.start.fromBufferAttribute(a, r), Z.end.fromBufferAttribute(o, r), Z.applyMatrix4(t);
|
|
2586
|
-
const u = new C(),
|
|
2587
|
-
ge.distanceSqToSegment(Z.start, Z.end,
|
|
2588
|
-
point:
|
|
2582
|
+
const u = new C(), d = new C();
|
|
2583
|
+
ge.distanceSqToSegment(Z.start, Z.end, d, u), d.distanceTo(u) < Fe * 0.5 && e.push({
|
|
2584
|
+
point: d,
|
|
2589
2585
|
pointOnLine: u,
|
|
2590
|
-
distance: ge.origin.distanceTo(
|
|
2586
|
+
distance: ge.origin.distanceTo(d),
|
|
2591
2587
|
object: i,
|
|
2592
2588
|
face: null,
|
|
2593
2589
|
faceIndex: r,
|
|
@@ -2597,29 +2593,29 @@ function hr(i, e) {
|
|
|
2597
2593
|
}
|
|
2598
2594
|
}
|
|
2599
2595
|
function pr(i, e, t) {
|
|
2600
|
-
const n = e.projectionMatrix, o = i.material.resolution, s = i.matrixWorld, r = i.geometry, c = r.attributes.instanceStart, u = r.attributes.instanceEnd,
|
|
2601
|
-
ge.at(1, de), de.w = 1, de.applyMatrix4(e.matrixWorldInverse), de.applyMatrix4(n), de.multiplyScalar(1 / de.w), de.x *= o.x / 2, de.y *= o.y / 2, de.z = 0,
|
|
2602
|
-
for (let h = 0, f =
|
|
2603
|
-
if (
|
|
2596
|
+
const n = e.projectionMatrix, o = i.material.resolution, s = i.matrixWorld, r = i.geometry, c = r.attributes.instanceStart, u = r.attributes.instanceEnd, d = Math.min(r.instanceCount, c.count), l = -e.near;
|
|
2597
|
+
ge.at(1, de), de.w = 1, de.applyMatrix4(e.matrixWorldInverse), de.applyMatrix4(n), de.multiplyScalar(1 / de.w), de.x *= o.x / 2, de.y *= o.y / 2, de.z = 0, an.copy(de), on.multiplyMatrices(e.matrixWorldInverse, s);
|
|
2598
|
+
for (let h = 0, f = d; h < f; h++) {
|
|
2599
|
+
if ($.fromBufferAttribute(c, h), K.fromBufferAttribute(u, h), $.w = 1, K.w = 1, $.applyMatrix4(on), K.applyMatrix4(on), $.z > l && K.z > l)
|
|
2604
2600
|
continue;
|
|
2605
|
-
if (
|
|
2606
|
-
const b =
|
|
2607
|
-
|
|
2608
|
-
} else if (
|
|
2609
|
-
const b =
|
|
2610
|
-
|
|
2601
|
+
if ($.z > l) {
|
|
2602
|
+
const b = $.z - K.z, v = ($.z - l) / b;
|
|
2603
|
+
$.lerp(K, v);
|
|
2604
|
+
} else if (K.z > l) {
|
|
2605
|
+
const b = K.z - $.z, v = (K.z - l) / b;
|
|
2606
|
+
K.lerp($, v);
|
|
2611
2607
|
}
|
|
2612
|
-
|
|
2613
|
-
const y = Z.closestPointToPointParameter(
|
|
2614
|
-
Z.at(y,
|
|
2615
|
-
const g = be.lerp(
|
|
2608
|
+
$.applyMatrix4(n), K.applyMatrix4(n), $.multiplyScalar(1 / $.w), K.multiplyScalar(1 / K.w), $.x *= o.x / 2, $.y *= o.y / 2, K.x *= o.x / 2, K.y *= o.y / 2, Z.start.copy($), Z.start.z = 0, Z.end.copy(K), Z.end.z = 0;
|
|
2609
|
+
const y = Z.closestPointToPointParameter(an, !0);
|
|
2610
|
+
Z.at(y, Ki);
|
|
2611
|
+
const g = be.lerp($.z, K.z, y), m = g >= -1 && g <= 1, x = an.distanceTo(Ki) < Fe * 0.5;
|
|
2616
2612
|
if (m && x) {
|
|
2617
2613
|
Z.start.fromBufferAttribute(c, h), Z.end.fromBufferAttribute(u, h), Z.start.applyMatrix4(s), Z.end.applyMatrix4(s);
|
|
2618
|
-
const b = new C(),
|
|
2619
|
-
ge.distanceSqToSegment(Z.start, Z.end,
|
|
2620
|
-
point:
|
|
2614
|
+
const b = new C(), v = new C();
|
|
2615
|
+
ge.distanceSqToSegment(Z.start, Z.end, v, b), t.push({
|
|
2616
|
+
point: v,
|
|
2621
2617
|
pointOnLine: b,
|
|
2622
|
-
distance: ge.origin.distanceTo(
|
|
2618
|
+
distance: ge.origin.distanceTo(v),
|
|
2623
2619
|
object: i,
|
|
2624
2620
|
face: null,
|
|
2625
2621
|
faceIndex: h,
|
|
@@ -2637,8 +2633,8 @@ class fr extends te {
|
|
|
2637
2633
|
computeLineDistances() {
|
|
2638
2634
|
const e = this.geometry, t = e.attributes.instanceStart, n = e.attributes.instanceEnd, a = new Float32Array(2 * t.count);
|
|
2639
2635
|
for (let s = 0, r = 0, c = t.count; s < c; s++, r += 2)
|
|
2640
|
-
Xi.fromBufferAttribute(t, s),
|
|
2641
|
-
const o = new
|
|
2636
|
+
Xi.fromBufferAttribute(t, s), $i.fromBufferAttribute(n, s), a[r] = r === 0 ? 0 : a[r - 1], a[r + 1] = a[r] + Xi.distanceTo($i);
|
|
2637
|
+
const o = new cn(a, 2, 1);
|
|
2642
2638
|
return e.setAttribute("instanceDistanceStart", new We(o, 1, 0)), e.setAttribute("instanceDistanceEnd", new We(o, 1, 1)), this;
|
|
2643
2639
|
}
|
|
2644
2640
|
raycast(e, t) {
|
|
@@ -2647,29 +2643,29 @@ class fr extends te {
|
|
|
2647
2643
|
const o = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
|
|
2648
2644
|
ge = e.ray;
|
|
2649
2645
|
const s = this.matrixWorld, r = this.geometry, c = this.material;
|
|
2650
|
-
|
|
2646
|
+
Fe = c.linewidth + o, r.boundingSphere === null && r.computeBoundingSphere(), St.copy(r.boundingSphere).applyMatrix4(s);
|
|
2651
2647
|
let u;
|
|
2652
2648
|
if (n)
|
|
2653
|
-
u =
|
|
2649
|
+
u = Fe * 0.5;
|
|
2654
2650
|
else {
|
|
2655
|
-
const
|
|
2656
|
-
u = Zi(a,
|
|
2651
|
+
const l = Math.max(a.near, St.distanceToPoint(ge.origin));
|
|
2652
|
+
u = Zi(a, l, c.resolution);
|
|
2657
2653
|
}
|
|
2658
|
-
if (
|
|
2654
|
+
if (St.radius += u, ge.intersectsSphere(St) === !1)
|
|
2659
2655
|
return;
|
|
2660
2656
|
r.boundingBox === null && r.computeBoundingBox(), vt.copy(r.boundingBox).applyMatrix4(s);
|
|
2661
|
-
let
|
|
2657
|
+
let d;
|
|
2662
2658
|
if (n)
|
|
2663
|
-
|
|
2659
|
+
d = Fe * 0.5;
|
|
2664
2660
|
else {
|
|
2665
|
-
const
|
|
2666
|
-
|
|
2661
|
+
const l = Math.max(a.near, vt.distanceToPoint(ge.origin));
|
|
2662
|
+
d = Zi(a, l, c.resolution);
|
|
2667
2663
|
}
|
|
2668
|
-
vt.expandByScalar(
|
|
2664
|
+
vt.expandByScalar(d), ge.intersectsBox(vt) !== !1 && (n ? hr(this, t) : pr(this, a, t));
|
|
2669
2665
|
}
|
|
2670
2666
|
onBeforeRender(e) {
|
|
2671
2667
|
const t = this.material.uniforms;
|
|
2672
|
-
t && t.resolution && (e.getViewport(
|
|
2668
|
+
t && t.resolution && (e.getViewport(sn), this.material.uniforms.resolution.value.set(sn.z, sn.w));
|
|
2673
2669
|
}
|
|
2674
2670
|
}
|
|
2675
2671
|
class pt extends na {
|
|
@@ -2699,13 +2695,13 @@ class pt extends na {
|
|
|
2699
2695
|
return this.setPositions(t.attributes.position.array), this;
|
|
2700
2696
|
}
|
|
2701
2697
|
}
|
|
2702
|
-
class
|
|
2698
|
+
class Re extends fr {
|
|
2703
2699
|
constructor(e = new pt(), t = new Xe({ color: Math.random() * 16777215 })) {
|
|
2704
2700
|
super(e, t), this.isLine2 = !0, this.type = "Line2";
|
|
2705
2701
|
}
|
|
2706
2702
|
}
|
|
2707
|
-
const ji = new C(), gr = new
|
|
2708
|
-
class mr extends
|
|
2703
|
+
const ji = new C(), gr = new _t(), qi = new C();
|
|
2704
|
+
class mr extends In {
|
|
2709
2705
|
constructor(e = document.createElement("div")) {
|
|
2710
2706
|
super(), this.isCSS3DObject = !0, this.element = e, this.element.style.position = "absolute", this.element.style.pointerEvents = "auto", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.addEventListener("removed", function() {
|
|
2711
2707
|
this.traverse(function(t) {
|
|
@@ -2725,7 +2721,7 @@ class ie extends mr {
|
|
|
2725
2721
|
return super.copy(e, t), this.rotation2D = e.rotation2D, this;
|
|
2726
2722
|
}
|
|
2727
2723
|
}
|
|
2728
|
-
const he = new
|
|
2724
|
+
const he = new $e(), yr = new $e();
|
|
2729
2725
|
class Ar {
|
|
2730
2726
|
constructor(e = {}) {
|
|
2731
2727
|
const t = this;
|
|
@@ -2737,8 +2733,8 @@ class Ar {
|
|
|
2737
2733
|
c.style.overflow = "hidden", this.domElement = c;
|
|
2738
2734
|
const u = document.createElement("div");
|
|
2739
2735
|
u.style.transformOrigin = "0 0", u.style.pointerEvents = "none", c.appendChild(u);
|
|
2740
|
-
const
|
|
2741
|
-
|
|
2736
|
+
const d = document.createElement("div");
|
|
2737
|
+
d.style.transformStyle = "preserve-3d", u.appendChild(d), this.getSize = function() {
|
|
2742
2738
|
return {
|
|
2743
2739
|
width: n,
|
|
2744
2740
|
height: a
|
|
@@ -2746,23 +2742,23 @@ class Ar {
|
|
|
2746
2742
|
}, this.render = function(g, m) {
|
|
2747
2743
|
const x = m.projectionMatrix.elements[5] * s;
|
|
2748
2744
|
m.view && m.view.enabled ? (u.style.transform = `translate( ${-m.view.offsetX * (n / m.view.width)}px, ${-m.view.offsetY * (a / m.view.height)}px )`, u.style.transform += `scale( ${m.view.fullWidth / m.view.width}, ${m.view.fullHeight / m.view.height} )`) : u.style.transform = "", g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), m.parent === null && m.matrixWorldAutoUpdate === !0 && m.updateMatrixWorld();
|
|
2749
|
-
let b,
|
|
2750
|
-
m.isOrthographicCamera && (b = -(m.right + m.left) / 2,
|
|
2751
|
-
const T = m.view && m.view.enabled ? m.view.height / m.view.fullHeight : 1, w = m.isOrthographicCamera ? `scale( ${T} )scale(` + x + ")translate(" +
|
|
2752
|
-
r.camera.style !==
|
|
2745
|
+
let b, v;
|
|
2746
|
+
m.isOrthographicCamera && (b = -(m.right + m.left) / 2, v = (m.top + m.bottom) / 2);
|
|
2747
|
+
const T = m.view && m.view.enabled ? m.view.height / m.view.fullHeight : 1, w = m.isOrthographicCamera ? `scale( ${T} )scale(` + x + ")translate(" + l(b) + "px," + l(v) + "px)" + h(m.matrixWorldInverse) : `scale( ${T} )translateZ(` + x + "px)" + h(m.matrixWorldInverse), S = (m.isPerspectiveCamera ? "perspective(" + x + "px) " : "") + w + "translate(" + o + "px," + s + "px)";
|
|
2748
|
+
r.camera.style !== S && (d.style.transform = S, r.camera.style = S), y(g, g, m);
|
|
2753
2749
|
}, this.setSize = function(g, m) {
|
|
2754
|
-
n = g, a = m, o = n / 2, s = a / 2, c.style.width = g + "px", c.style.height = m + "px", u.style.width = g + "px", u.style.height = m + "px",
|
|
2750
|
+
n = g, a = m, o = n / 2, s = a / 2, c.style.width = g + "px", c.style.height = m + "px", u.style.width = g + "px", u.style.height = m + "px", d.style.width = g + "px", d.style.height = m + "px";
|
|
2755
2751
|
};
|
|
2756
|
-
function
|
|
2752
|
+
function l(g) {
|
|
2757
2753
|
return Math.abs(g) < 1e-10 ? 0 : g;
|
|
2758
2754
|
}
|
|
2759
2755
|
function h(g) {
|
|
2760
2756
|
const m = g.elements;
|
|
2761
|
-
return "matrix3d(" +
|
|
2757
|
+
return "matrix3d(" + l(m[0]) + "," + l(-m[1]) + "," + l(m[2]) + "," + l(m[3]) + "," + l(m[4]) + "," + l(-m[5]) + "," + l(m[6]) + "," + l(m[7]) + "," + l(m[8]) + "," + l(-m[9]) + "," + l(m[10]) + "," + l(m[11]) + "," + l(m[12]) + "," + l(-m[13]) + "," + l(m[14]) + "," + l(m[15]) + ")";
|
|
2762
2758
|
}
|
|
2763
2759
|
function f(g) {
|
|
2764
2760
|
const m = g.elements;
|
|
2765
|
-
return "translate(-50%,-50%)" + ("matrix3d(" +
|
|
2761
|
+
return "translate(-50%,-50%)" + ("matrix3d(" + l(m[0]) + "," + l(m[1]) + "," + l(m[2]) + "," + l(m[3]) + "," + l(-m[4]) + "," + l(-m[5]) + "," + l(-m[6]) + "," + l(-m[7]) + "," + l(m[8]) + "," + l(m[9]) + "," + l(m[10]) + "," + l(m[11]) + "," + l(m[12]) + "," + l(m[13]) + "," + l(m[14]) + "," + l(m[15]) + ")");
|
|
2766
2762
|
}
|
|
2767
2763
|
function p(g) {
|
|
2768
2764
|
g.isCSS3DObject && (g.element.style.display = "none");
|
|
@@ -2775,26 +2771,26 @@ class Ar {
|
|
|
2775
2771
|
return;
|
|
2776
2772
|
}
|
|
2777
2773
|
if (g.isCSS3DObject) {
|
|
2778
|
-
const
|
|
2779
|
-
if (T.style.display =
|
|
2774
|
+
const v = g.layers.test(x.layers) === !0, T = g.element;
|
|
2775
|
+
if (T.style.display = v === !0 ? "" : "none", v === !0) {
|
|
2780
2776
|
g.onBeforeRender(t, m, x);
|
|
2781
2777
|
let w;
|
|
2782
2778
|
g.isCSS3DSprite ? (he.copy(x.matrixWorldInverse), he.transpose(), g.rotation2D !== 0 && he.multiply(yr.makeRotationZ(g.rotation2D)), g.matrixWorld.decompose(ji, gr, qi), he.setPosition(ji), he.scale(qi), he.elements[3] = 0, he.elements[7] = 0, he.elements[11] = 0, he.elements[15] = 1, w = f(he)) : w = f(g.matrixWorld);
|
|
2783
2779
|
const I = r.objects.get(g);
|
|
2784
2780
|
if (I === void 0 || I.style !== w) {
|
|
2785
2781
|
T.style.transform = w;
|
|
2786
|
-
const
|
|
2787
|
-
r.objects.set(g,
|
|
2782
|
+
const S = { style: w };
|
|
2783
|
+
r.objects.set(g, S);
|
|
2788
2784
|
}
|
|
2789
|
-
T.parentNode !==
|
|
2785
|
+
T.parentNode !== d && d.appendChild(T), g.onAfterRender(t, m, x);
|
|
2790
2786
|
}
|
|
2791
2787
|
}
|
|
2792
|
-
for (let
|
|
2793
|
-
y(g.children[
|
|
2788
|
+
for (let v = 0, T = g.children.length; v < T; v++)
|
|
2789
|
+
y(g.children[v], m, x);
|
|
2794
2790
|
}
|
|
2795
2791
|
}
|
|
2796
2792
|
}
|
|
2797
|
-
class
|
|
2793
|
+
class Cn extends Re {
|
|
2798
2794
|
constructor(e) {
|
|
2799
2795
|
super(), this.isMark = !0, this.disposed = !1, this.events = e;
|
|
2800
2796
|
}
|
|
@@ -2802,8 +2798,7 @@ class Mn extends Fe {
|
|
|
2802
2798
|
* 绘制开始
|
|
2803
2799
|
*/
|
|
2804
2800
|
drawStart(e, t) {
|
|
2805
|
-
if (this.disposed)
|
|
2806
|
-
return;
|
|
2801
|
+
if (this.disposed) return;
|
|
2807
2802
|
const n = this, a = document.querySelectorAll(".mark-wrap-line.main-warp").length + 1, o = {
|
|
2808
2803
|
type: "MarkDistanceLine",
|
|
2809
2804
|
name: t || "line" + Date.now(),
|
|
@@ -2823,19 +2818,18 @@ class Mn extends Fe {
|
|
|
2823
2818
|
}, s = new pt();
|
|
2824
2819
|
s.setPositions([...o.startPoint, ...o.endPoint]);
|
|
2825
2820
|
const r = new Xe({ color: o.lineColor, linewidth: o.lineWidth });
|
|
2826
|
-
r.resolution.set(innerWidth, innerHeight), n.copy(new
|
|
2821
|
+
r.resolution.set(innerWidth, innerHeight), n.copy(new Re(s, r));
|
|
2827
2822
|
const c = new De(0.05, 32), u = new xe({ color: 16777215, side: we });
|
|
2828
2823
|
u.transparent = !0, u.opacity = 0.6;
|
|
2829
|
-
const l = new te(c, u);
|
|
2830
|
-
l.position.copy(e), l.isMark = !0;
|
|
2831
2824
|
const d = new te(c, u);
|
|
2832
2825
|
d.position.copy(e), d.isMark = !0;
|
|
2826
|
+
const l = new te(c, u);
|
|
2827
|
+
l.position.copy(e), l.isMark = !0;
|
|
2833
2828
|
const h = document.createElement("div");
|
|
2834
2829
|
h.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
2835
2830
|
<span class="${o.name}-main-tag" style="color:${o.mainTagColor};background:${o.mainTagBackground};opacity:${o.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${o.title}</span>
|
|
2836
2831
|
</div>`, h.classList.add("mark-wrap-line", `${o.name}`, "main-warp"), h.style.position = "absolute", h.style.borderRadius = "4px", h.style.cursor = "pointer", h.onclick = () => {
|
|
2837
|
-
if (n.events.fire(_).markMode)
|
|
2838
|
-
return;
|
|
2832
|
+
if (n.events.fire(_).markMode) return;
|
|
2839
2833
|
const g = parent?.onActiveMark;
|
|
2840
2834
|
g?.(n.getMarkData(!0)), n.events.fire(q);
|
|
2841
2835
|
}, h.oncontextmenu = (g) => g.preventDefault();
|
|
@@ -2844,14 +2838,13 @@ class Mn extends Fe {
|
|
|
2844
2838
|
const p = document.createElement("div");
|
|
2845
2839
|
p.innerHTML = `<span class="${t}-distance-tag ${t}-distance-tag0" style="color:${o.distanceTagColor};background:${o.distanceTagBackground};opacity:${o.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;"></span>`, p.classList.add("mark-wrap-line", `${t}`, "distance-warp"), p.style.position = "absolute", p.style.borderRadius = "4px", p.style.pointerEvents = "none";
|
|
2846
2840
|
const y = new ie(p);
|
|
2847
|
-
y.position.set(e.x, e.y, e.z), y.element.style.pointerEvents = "none", y.scale.set(8e-3, 8e-3, 8e-3), y.visible = !1, n.add(
|
|
2841
|
+
y.position.set(e.x, e.y, e.z), y.element.style.pointerEvents = "none", y.scale.set(8e-3, 8e-3, 8e-3), y.visible = !1, n.add(d, l, f, y), n.data = o, n.circleStart = d, n.circleEnd = l, n.css3dTag = y, n.css3dMainTag = f, n.events.fire(Me, n);
|
|
2848
2842
|
}
|
|
2849
2843
|
/**
|
|
2850
2844
|
* 绘制更新
|
|
2851
2845
|
*/
|
|
2852
2846
|
drawUpdate(e, t = !0) {
|
|
2853
|
-
if (this.disposed)
|
|
2854
|
-
return;
|
|
2847
|
+
if (this.disposed) return;
|
|
2855
2848
|
const n = this;
|
|
2856
2849
|
if (e?.endPoint) {
|
|
2857
2850
|
t && (n.data.endPoint = [...e.endPoint]);
|
|
@@ -2879,8 +2872,7 @@ class Mn extends Fe {
|
|
|
2879
2872
|
* 绘制结束
|
|
2880
2873
|
*/
|
|
2881
2874
|
drawFinish(e) {
|
|
2882
|
-
if (this.disposed)
|
|
2883
|
-
return;
|
|
2875
|
+
if (this.disposed) return;
|
|
2884
2876
|
const t = this;
|
|
2885
2877
|
t.data.endPoint = [...e.toArray()];
|
|
2886
2878
|
const n = new C().fromArray(t.data.startPoint), a = new C().fromArray(t.data.endPoint), o = new C((n.x + a.x) / 2, (n.y + a.y) / 2, (n.z + a.z) / 2);
|
|
@@ -2891,15 +2883,14 @@ class Mn extends Fe {
|
|
|
2891
2883
|
t.css3dTag.visible = !0;
|
|
2892
2884
|
const c = (r * t.events.fire(_).meterScale).toFixed(2) + " m";
|
|
2893
2885
|
t.css3dTag.element.childNodes[0].innerText = c, t.events.fire(Te);
|
|
2894
|
-
const u = parent?.onActiveMark,
|
|
2895
|
-
|
|
2886
|
+
const u = parent?.onActiveMark, d = t.getMarkData(!0);
|
|
2887
|
+
d.isNew = !0, d.meterScale = t.events.fire(_).meterScale, u?.(d);
|
|
2896
2888
|
}
|
|
2897
2889
|
/**
|
|
2898
2890
|
* 根据数据直接绘制
|
|
2899
2891
|
*/
|
|
2900
2892
|
draw(e) {
|
|
2901
|
-
if (this.disposed)
|
|
2902
|
-
return;
|
|
2893
|
+
if (this.disposed) return;
|
|
2903
2894
|
const t = this, n = {
|
|
2904
2895
|
type: "MarkDistanceLine",
|
|
2905
2896
|
name: e.name || "line" + Date.now(),
|
|
@@ -2919,21 +2910,20 @@ class Mn extends Fe {
|
|
|
2919
2910
|
}, a = new C().fromArray(n.startPoint), o = new C().fromArray(n.endPoint), s = new C((a.x + o.x) / 2, (a.y + o.y) / 2, (a.z + o.z) / 2), r = new pt();
|
|
2920
2911
|
r.setPositions([...n.startPoint, ...n.endPoint]);
|
|
2921
2912
|
const c = new Xe({ color: n.lineColor, linewidth: n.lineWidth });
|
|
2922
|
-
c.resolution.set(innerWidth, innerHeight), t.copy(new
|
|
2923
|
-
const u = new De(0.05, 32),
|
|
2924
|
-
|
|
2925
|
-
const
|
|
2926
|
-
|
|
2927
|
-
const h = new te(u,
|
|
2913
|
+
c.resolution.set(innerWidth, innerHeight), t.copy(new Re(r, c));
|
|
2914
|
+
const u = new De(0.05, 32), d = new xe({ color: 16777215, side: we });
|
|
2915
|
+
d.transparent = !0, d.opacity = 0.6;
|
|
2916
|
+
const l = new te(u, d);
|
|
2917
|
+
l.position.copy(a), l.isMark = !0;
|
|
2918
|
+
const h = new te(u, d);
|
|
2928
2919
|
h.position.copy(o), h.isMark = !0;
|
|
2929
2920
|
const f = o.clone().sub(a).normalize();
|
|
2930
|
-
|
|
2921
|
+
l.lookAt(l.position.clone().add(f)), h.lookAt(h.position.clone().add(f));
|
|
2931
2922
|
const p = n.name, y = document.createElement("div");
|
|
2932
2923
|
y.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
2933
2924
|
<span class="${p}-main-tag" style="color:${n.mainTagColor};background:${n.mainTagBackground};opacity:${n.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: auto;">${n.title}</span>
|
|
2934
2925
|
</div>`, y.classList.add("mark-wrap-line", `${n.name}`, "main-warp"), y.style.position = "absolute", y.style.borderRadius = "4px", y.style.cursor = "pointer", y.onclick = () => {
|
|
2935
|
-
if (t.events.fire(_).markMode)
|
|
2936
|
-
return;
|
|
2926
|
+
if (t.events.fire(_).markMode) return;
|
|
2937
2927
|
const T = parent?.onActiveMark;
|
|
2938
2928
|
T?.(t.getMarkData(!0)), t.events.fire(q);
|
|
2939
2929
|
}, y.oncontextmenu = (T) => T.preventDefault();
|
|
@@ -2941,30 +2931,28 @@ class Mn extends Fe {
|
|
|
2941
2931
|
g.position.copy(a), g.element.style.pointerEvents = "none", g.scale.set(0.01, 0.01, 0.01), g.visible = n.mainTagVisible;
|
|
2942
2932
|
const x = (a.distanceTo(o) * t.events.fire(_).meterScale).toFixed(2) + " m", b = document.createElement("div");
|
|
2943
2933
|
b.innerHTML = `<span class="${p}-distance-tag ${p}-distance-tag0" style="color:${n.distanceTagColor};background:${n.distanceTagBackground};opacity:${n.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${x}</span>`, b.classList.add("mark-wrap-line", `${p}`, "distance-warp"), b.style.position = "absolute", b.style.borderRadius = "4px", b.style.pointerEvents = "none";
|
|
2944
|
-
const
|
|
2945
|
-
|
|
2934
|
+
const v = new ie(b);
|
|
2935
|
+
v.position.copy(s), v.element.style.pointerEvents = "none", v.scale.set(8e-3, 8e-3, 8e-3), v.visible = n.distanceTagVisible, t.add(l, h, g, v), t.data = n, t.circleStart = l, t.circleEnd = h, t.css3dTag = v, t.css3dMainTag = g, t.events.fire(Me, t);
|
|
2946
2936
|
}
|
|
2947
2937
|
getMarkData(e = !1) {
|
|
2948
2938
|
const t = { ...this.data };
|
|
2949
2939
|
return e ? (delete t.startPoint, delete t.endPoint) : (t.startPoint = [...t.startPoint], t.endPoint = [...t.endPoint]), t;
|
|
2950
2940
|
}
|
|
2951
2941
|
dispose() {
|
|
2952
|
-
if (this.disposed)
|
|
2953
|
-
return;
|
|
2942
|
+
if (this.disposed) return;
|
|
2954
2943
|
const e = this;
|
|
2955
2944
|
e.disposed = !0, e.events.fire(ke, e), e.events.fire(B).remove(e), e.events.fire(Ze, e), document.querySelectorAll(`.${e.data.name}`).forEach((n) => n.parentElement?.removeChild(n)), e.events = null, e.data = null, e.circleStart = null, e.circleEnd = null, e.css3dTag = null, e.css3dMainTag = null;
|
|
2956
2945
|
}
|
|
2957
2946
|
}
|
|
2958
|
-
class
|
|
2947
|
+
class Mn extends Re {
|
|
2959
2948
|
constructor(e) {
|
|
2960
|
-
super(), this.isMark = !0, this.disposed = !1, this.css3dTags = [], this.group = new
|
|
2949
|
+
super(), this.isMark = !0, this.disposed = !1, this.css3dTags = [], this.group = new Qt(), this.add(this.group), this.events = e;
|
|
2961
2950
|
}
|
|
2962
2951
|
/**
|
|
2963
2952
|
* 绘制开始
|
|
2964
2953
|
*/
|
|
2965
2954
|
drawStart(e, t) {
|
|
2966
|
-
if (this.disposed)
|
|
2967
|
-
return;
|
|
2955
|
+
if (this.disposed) return;
|
|
2968
2956
|
const n = document.querySelectorAll(".mark-wrap-lines.main-warp").length + 1, a = {
|
|
2969
2957
|
type: "MarkMultiLines",
|
|
2970
2958
|
name: t || "lines" + Date.now(),
|
|
@@ -2988,18 +2976,17 @@ class Tn extends Fe {
|
|
|
2988
2976
|
* 绘制更新
|
|
2989
2977
|
*/
|
|
2990
2978
|
drawUpdate(e, t = !0, n, a = !1) {
|
|
2991
|
-
if (this.disposed)
|
|
2992
|
-
return;
|
|
2979
|
+
if (this.disposed) return;
|
|
2993
2980
|
const o = this;
|
|
2994
2981
|
if (n)
|
|
2995
2982
|
if (a) {
|
|
2996
|
-
const s = o.data.points.length, r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = n,
|
|
2997
|
-
o.css3dTags[r].element.childNodes[0].innerText = h, o.css3dTags[r].position.set(
|
|
2983
|
+
const s = o.data.points.length, r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = n, d = new C((c.x + u.x) / 2, (c.y + u.y) / 2, (c.z + u.z) / 2), h = (c.distanceTo(u) * o.events.fire(_).meterScale).toFixed(2) + " m";
|
|
2984
|
+
o.css3dTags[r].element.childNodes[0].innerText = h, o.css3dTags[r].position.set(d.x, d.y, d.z), o.css3dTags[r].visible = !0, o.data.points.pop(), o.data.points.pop(), o.data.points.pop(), o.data.points = [...o.data.points, ...n.toArray(), ...n.toArray()], o.css3dTags[o.css3dTags.length - 1].visible = !0, this.draw(this.data);
|
|
2998
2985
|
} else {
|
|
2999
2986
|
const s = o.data.points.length;
|
|
3000
2987
|
o.data.points[s - 3] = n.x, o.data.points[s - 2] = n.y, o.data.points[s - 1] = n.z;
|
|
3001
|
-
const r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = new C().fromArray(o.data.points.slice(s - 3)),
|
|
3002
|
-
o.css3dTags[r].element.childNodes[0].innerText = h, o.geometry.setPositions([...o.data.points]), o.css3dTags[r].position.set(
|
|
2988
|
+
const r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = new C().fromArray(o.data.points.slice(s - 3)), d = new C((c.x + u.x) / 2, (c.y + u.y) / 2, (c.z + u.z) / 2), l = c.distanceTo(u), h = (l * o.events.fire(_).meterScale).toFixed(2) + " m";
|
|
2989
|
+
o.css3dTags[r].element.childNodes[0].innerText = h, o.geometry.setPositions([...o.data.points]), o.css3dTags[r].position.set(d.x, d.y, d.z), o.css3dTags[r].visible = a ? !0 : l > 0.5;
|
|
3003
2990
|
}
|
|
3004
2991
|
e?.lineColor && (t && (o.data.lineColor = e.lineColor), o.material.color.set(e.lineColor)), e?.lineWidth && (t && (o.data.lineWidth = e.lineWidth), o.material.linewidth = e.lineWidth), e?.mainTagColor && (t && (o.data.mainTagColor = e.mainTagColor), document.querySelector(`.${o.data.name}-main-tag`).style.color = e.mainTagColor), e?.mainTagBackground && (t && (o.data.mainTagBackground = e.mainTagBackground), document.querySelector(`.${o.data.name}-main-tag`).style.background = e.mainTagBackground), e?.mainTagOpacity && (t && (o.data.mainTagOpacity = e.mainTagOpacity), document.querySelector(`.${o.data.name}-main-tag`).style.opacity = e.mainTagOpacity.toString()), e?.mainTagVisible !== void 0 && (t && (o.data.mainTagVisible = e.mainTagVisible), o.css3dMainTag.visible = e.mainTagVisible), e?.distanceTagColor && (t && (o.data.distanceTagColor = e.distanceTagColor), document.querySelectorAll(`.${o.data.name}-distance-tag`)?.forEach((r) => r.style.color = e.distanceTagColor)), e?.distanceTagBackground && (t && (o.data.distanceTagBackground = e.distanceTagBackground), document.querySelectorAll(`.${o.data.name}-distance-tag`)?.forEach((r) => r.style.background = e.distanceTagBackground)), e?.distanceTagOpacity && (t && (o.data.distanceTagOpacity = e.distanceTagOpacity), document.querySelectorAll(`.${o.data.name}-distance-tag`)?.forEach((r) => r.style.opacity = e.distanceTagOpacity.toString())), e?.distanceTagVisible !== void 0 && (t && (o.data.distanceTagVisible = e.distanceTagVisible), o.css3dTags.forEach((s) => s.visible = e.distanceTagVisible)), e?.title !== void 0 && (t && (o.data.title = e.title), this.css3dMainTag.element.querySelector(`.${o.data.name}-main-tag`).innerText = e.title), e?.note !== void 0 && t && (o.data.note = e.note), o.events.fire(J);
|
|
3005
2992
|
}
|
|
@@ -3018,8 +3005,7 @@ class Tn extends Fe {
|
|
|
3018
3005
|
* 绘制结束
|
|
3019
3006
|
*/
|
|
3020
3007
|
drawFinish(e) {
|
|
3021
|
-
if (this.disposed)
|
|
3022
|
-
return;
|
|
3008
|
+
if (this.disposed) return;
|
|
3023
3009
|
const t = this, n = t.data.points.length, a = new C().fromArray(t.data.points.slice(n - 6, n - 3)), o = new C().fromArray(t.data.points.slice(n - 3));
|
|
3024
3010
|
if ((!e || a.distanceTo(o) < 1e-3) && (t.data.points.pop(), t.data.points.pop(), t.data.points.pop(), t.draw(t.data)), t.events.fire(Te), t.data.points.length < 6) {
|
|
3025
3011
|
t.dispose();
|
|
@@ -3038,8 +3024,7 @@ class Tn extends Fe {
|
|
|
3038
3024
|
* 根据数据直接绘制
|
|
3039
3025
|
*/
|
|
3040
3026
|
draw(e, t = !1) {
|
|
3041
|
-
if (this.disposed)
|
|
3042
|
-
return;
|
|
3027
|
+
if (this.disposed) return;
|
|
3043
3028
|
const n = this;
|
|
3044
3029
|
this.css3dTags = this.css3dTags || [];
|
|
3045
3030
|
const a = {
|
|
@@ -3061,24 +3046,23 @@ class Tn extends Fe {
|
|
|
3061
3046
|
}, o = n.geometry, s = n.material, r = new pt();
|
|
3062
3047
|
r.setPositions([...a.points]);
|
|
3063
3048
|
const c = new Xe({ color: a.lineColor, linewidth: a.lineWidth });
|
|
3064
|
-
c.resolution.set(innerWidth, innerHeight), n.copy(new
|
|
3065
|
-
const u = a.name,
|
|
3049
|
+
c.resolution.set(innerWidth, innerHeight), n.copy(new Re(r, c)), o?.dispose(), s?.dispose();
|
|
3050
|
+
const u = a.name, d = a.points.length / 3 - 1;
|
|
3066
3051
|
if (!n.css3dMainTag) {
|
|
3067
|
-
const
|
|
3068
|
-
|
|
3052
|
+
const l = document.createElement("div");
|
|
3053
|
+
l.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
3069
3054
|
<span class="${u}-main-tag" style="color:${a.mainTagColor};background:${a.mainTagBackground};opacity:${a.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${a.title}</span>
|
|
3070
|
-
</div>`,
|
|
3071
|
-
if (n.events.fire(_).markMode)
|
|
3072
|
-
return;
|
|
3055
|
+
</div>`, l.classList.add("mark-wrap-lines", `${a.name}`, "main-warp"), l.style.position = "absolute", l.style.borderRadius = "4px", l.style.cursor = "pointer", l.onclick = () => {
|
|
3056
|
+
if (n.events.fire(_).markMode) return;
|
|
3073
3057
|
const f = parent?.onActiveMark, p = n.getMarkData(!0);
|
|
3074
3058
|
p.meterScale = n.events.fire(_).meterScale, f?.(p), n.events.fire(q);
|
|
3075
|
-
},
|
|
3076
|
-
const h = new ie(
|
|
3059
|
+
}, l.oncontextmenu = (f) => f.preventDefault();
|
|
3060
|
+
const h = new ie(l);
|
|
3077
3061
|
h.position.set(a.points[0], a.points[1], a.points[2]), h.element.style.pointerEvents = "none", h.scale.set(0.01, 0.01, 0.01), h.visible = a.mainTagVisible, n.group.add(h), n.css3dMainTag = h;
|
|
3078
3062
|
}
|
|
3079
|
-
for (let
|
|
3080
|
-
const h = new C().fromArray(a.points.slice(
|
|
3081
|
-
m.innerHTML = `<span class="${u}-distance-tag ${u}-distance-tag${
|
|
3063
|
+
for (let l = n.css3dTags.length; l < d; l++) {
|
|
3064
|
+
const h = new C().fromArray(a.points.slice(l * 3, l * 3 + 3)), f = new C().fromArray(a.points.slice(l * 3 + 3, l * 3 + 6)), p = new C((h.x + f.x) / 2, (h.y + f.y) / 2, (h.z + f.z) / 2), g = (h.distanceTo(f) * n.events.fire(_).meterScale).toFixed(2) + " m", m = document.createElement("div");
|
|
3065
|
+
m.innerHTML = `<span class="${u}-distance-tag ${u}-distance-tag${l}" style="color:${a.distanceTagColor};background:${a.distanceTagBackground};opacity:${a.distanceTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${g}</span>`, m.classList.add("mark-wrap-lines", `${u}`, "distance-warp"), m.style.position = "absolute", m.style.borderRadius = "4px", m.style.display = "none";
|
|
3082
3066
|
const x = new ie(m);
|
|
3083
3067
|
x.position.copy(p), x.element.style.pointerEvents = "none", x.scale.set(8e-3, 8e-3, 8e-3), x.visible = a.distanceTagVisible, n.css3dTags.push(x), n.group.add(x);
|
|
3084
3068
|
}
|
|
@@ -3089,13 +3073,12 @@ class Tn extends Fe {
|
|
|
3089
3073
|
return e ? delete t.points : t.points = [...t.points], t;
|
|
3090
3074
|
}
|
|
3091
3075
|
dispose() {
|
|
3092
|
-
if (this.disposed)
|
|
3093
|
-
return;
|
|
3076
|
+
if (this.disposed) return;
|
|
3094
3077
|
const e = this;
|
|
3095
3078
|
e.disposed = !0, e.events.fire(ke, e), e.events.fire(B).remove(e), e.events.fire(Ze, e), e.geometry.dispose(), e.material.dispose(), document.querySelectorAll(`.${e.data.name}`).forEach((n) => n.parentElement?.removeChild(n)), e.events = null, e.data = null, e.css3dTags = null, e.group = null;
|
|
3096
3079
|
}
|
|
3097
3080
|
}
|
|
3098
|
-
class ia extends
|
|
3081
|
+
class ia extends Qt {
|
|
3099
3082
|
constructor(e, t, n) {
|
|
3100
3083
|
super(), this.isMark = !0, this.disposed = !1, this.events = e;
|
|
3101
3084
|
const a = this;
|
|
@@ -3134,8 +3117,7 @@ class ia extends Ht {
|
|
|
3134
3117
|
<span class="${o.name}" style="color:${o.mainTagColor};background:${o.mainTagBackground};opacity:${o.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: auto;">${o.title}</span>
|
|
3135
3118
|
<svg height="20" width="20" style="color:${o.iconColor};opacity:${o.iconOpacity};"><use href="${o.iconName}" fill="currentColor" /></svg>
|
|
3136
3119
|
</div>`, s.classList.add("mark-wrap-point", `mark-wrap-${o.name}`), s.style.position = "absolute", s.style.borderRadius = "4px", s.style.cursor = "pointer", s.onclick = () => {
|
|
3137
|
-
if (a.events.fire(_).markMode)
|
|
3138
|
-
return;
|
|
3120
|
+
if (a.events.fire(_).markMode) return;
|
|
3139
3121
|
const c = parent?.onActiveMark;
|
|
3140
3122
|
c?.(a.getMarkData(!0)), a.events.fire(q);
|
|
3141
3123
|
}, s.oncontextmenu = (c) => c.preventDefault();
|
|
@@ -3146,8 +3128,7 @@ class ia extends Ht {
|
|
|
3146
3128
|
* 绘制更新
|
|
3147
3129
|
*/
|
|
3148
3130
|
drawUpdate(e, t = !0) {
|
|
3149
|
-
if (this.disposed)
|
|
3150
|
-
return;
|
|
3131
|
+
if (this.disposed) return;
|
|
3151
3132
|
const n = this;
|
|
3152
3133
|
if (e?.iconName) {
|
|
3153
3134
|
t && (n.data.iconName = e.iconName);
|
|
@@ -3173,8 +3154,7 @@ class ia extends Ht {
|
|
|
3173
3154
|
* 绘制结束
|
|
3174
3155
|
*/
|
|
3175
3156
|
drawFinish() {
|
|
3176
|
-
if (this.disposed)
|
|
3177
|
-
return;
|
|
3157
|
+
if (this.disposed) return;
|
|
3178
3158
|
const e = this;
|
|
3179
3159
|
e.events.fire(Te);
|
|
3180
3160
|
const t = parent?.onActiveMark, n = e.getMarkData(!0);
|
|
@@ -3185,24 +3165,22 @@ class ia extends Ht {
|
|
|
3185
3165
|
return e ? delete t.point : t.point = [...t.point], t;
|
|
3186
3166
|
}
|
|
3187
3167
|
dispose() {
|
|
3188
|
-
if (this.disposed)
|
|
3189
|
-
return;
|
|
3168
|
+
if (this.disposed) return;
|
|
3190
3169
|
const e = this;
|
|
3191
3170
|
e.disposed = !0, e.events.fire(ke, e), e.events.fire(B).remove(e), e.events.fire(Ze, e);
|
|
3192
3171
|
const t = document.querySelector(`.mark-wrap-${e.data.name}`);
|
|
3193
3172
|
t?.parentElement?.removeChild?.(t), e.events = null, e.data = null, e.css3dTag = null;
|
|
3194
3173
|
}
|
|
3195
3174
|
}
|
|
3196
|
-
class
|
|
3175
|
+
class Tn extends Re {
|
|
3197
3176
|
constructor(e) {
|
|
3198
|
-
super(), this.isMark = !0, this.disposed = !1, this.css3dTags = [], this.group = new
|
|
3177
|
+
super(), this.isMark = !0, this.disposed = !1, this.css3dTags = [], this.group = new Qt(), this.add(this.group), this.events = e;
|
|
3199
3178
|
}
|
|
3200
3179
|
/**
|
|
3201
3180
|
* 绘制开始
|
|
3202
3181
|
*/
|
|
3203
3182
|
drawStart(e, t) {
|
|
3204
|
-
if (this.disposed)
|
|
3205
|
-
return;
|
|
3183
|
+
if (this.disposed) return;
|
|
3206
3184
|
const n = document.querySelectorAll(".mark-wrap-plans.main-warp").length + 1, a = {
|
|
3207
3185
|
type: "MarkMultiPlans",
|
|
3208
3186
|
name: t || "plans" + Date.now(),
|
|
@@ -3228,21 +3206,20 @@ class kn extends Fe {
|
|
|
3228
3206
|
* 绘制更新
|
|
3229
3207
|
*/
|
|
3230
3208
|
drawUpdate(e, t = !0, n, a = !1) {
|
|
3231
|
-
if (this.disposed)
|
|
3232
|
-
return;
|
|
3209
|
+
if (this.disposed) return;
|
|
3233
3210
|
const o = this;
|
|
3234
3211
|
if (n)
|
|
3235
3212
|
if (a) {
|
|
3236
|
-
const s = o.data.points.length, r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = n,
|
|
3237
|
-
o.css3dTags[r].element.innerText = h, o.css3dTags[r].position.set(
|
|
3213
|
+
const s = o.data.points.length, r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = n, d = new C((c.x + u.x) / 2, (c.y + u.y) / 2, (c.z + u.z) / 2), h = (c.distanceTo(u) * o.events.fire(_).meterScale).toFixed(2) + " m";
|
|
3214
|
+
o.css3dTags[r].element.innerText = h, o.css3dTags[r].position.set(d.x, d.y, d.z), o.css3dTags[r].visible = !0, o.data.points.pop(), o.data.points.pop(), o.data.points.pop(), o.data.points = [...o.data.points, ...n.toArray(), ...n.toArray()], this.draw(this.data);
|
|
3238
3215
|
} else {
|
|
3239
3216
|
const s = o.data.points.length;
|
|
3240
3217
|
o.data.points[s - 3] = n.x, o.data.points[s - 2] = n.y, o.data.points[s - 1] = n.z;
|
|
3241
|
-
const r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = new C().fromArray(o.data.points.slice(s - 3)),
|
|
3242
|
-
o.css3dTags[r].element.innerText = h, o.geometry.setPositions([...o.data.points]), o.css3dTags[r].position.set(
|
|
3243
|
-
const f = o.events.fire(
|
|
3218
|
+
const r = o.css3dTags.length - 1, c = new C().fromArray(o.data.points.slice(s - 6, s - 3)), u = new C().fromArray(o.data.points.slice(s - 3)), d = new C((c.x + u.x) / 2, (c.y + u.y) / 2, (c.z + u.z) / 2), l = c.distanceTo(u), h = (l * o.events.fire(_).meterScale).toFixed(2) + " m";
|
|
3219
|
+
o.css3dTags[r].element.innerText = h, o.geometry.setPositions([...o.data.points]), o.css3dTags[r].position.set(d.x, d.y, d.z), o.css3dTags[r].visible = a ? !0 : l > 0.5, o.meshPlans.geometry.setAttribute("position", new He(new Float32Array(o.data.points), 3)), o.meshPlans.geometry.attributes.position.needsUpdate = !0;
|
|
3220
|
+
const f = o.events.fire(ln, o.data.points);
|
|
3244
3221
|
o.css3dAreaTag.position.copy(f);
|
|
3245
|
-
const p = o.events.fire(
|
|
3222
|
+
const p = o.events.fire(dn, o.data.points);
|
|
3246
3223
|
o.css3dAreaTag.element.childNodes[0].innerText = p.toFixed(2) + " m²";
|
|
3247
3224
|
}
|
|
3248
3225
|
if (e?.lineColor && (t && (o.data.lineColor = e.lineColor), o.material.color.set(e.lineColor), o.meshPlans.material.color.set(e.lineColor)), e?.lineWidth && (t && (o.data.lineWidth = e.lineWidth), o.material.linewidth = e.lineWidth), e?.mainTagColor && (t && (o.data.mainTagColor = e.mainTagColor), document.querySelector(`.${o.data.name}-main-tag`).style.color = e.mainTagColor), e?.mainTagBackground && (t && (o.data.mainTagBackground = e.mainTagBackground), document.querySelector(`.${o.data.name}-main-tag`).style.background = e.mainTagBackground), e?.mainTagOpacity && (t && (o.data.mainTagOpacity = e.mainTagOpacity), document.querySelector(`.${o.data.name}-main-tag`).style.opacity = e.mainTagOpacity.toString()), e?.mainTagVisible !== void 0 && (t && (o.data.mainTagVisible = e.mainTagVisible), o.css3dMainTag.visible = e.mainTagVisible), e?.areaTagVisible !== void 0 && (t && (o.data.areaTagVisible = e.areaTagVisible), o.css3dAreaTag.visible = e.areaTagVisible), e?.areaTagColor) {
|
|
@@ -3279,8 +3256,7 @@ class kn extends Fe {
|
|
|
3279
3256
|
* 绘制结束
|
|
3280
3257
|
*/
|
|
3281
3258
|
drawFinish(e) {
|
|
3282
|
-
if (this.disposed)
|
|
3283
|
-
return;
|
|
3259
|
+
if (this.disposed) return;
|
|
3284
3260
|
const t = this, n = t.data.points.length, a = new C().fromArray(t.data.points.slice(n - 6, n - 3)), o = new C().fromArray(t.data.points.slice(n - 3));
|
|
3285
3261
|
if ((!e || a.distanceTo(o) < 1e-4) && (t.data.points.pop(), t.data.points.pop(), t.data.points.pop()), t.events.fire(Te), t.data.points.length < 9) {
|
|
3286
3262
|
t.dispose();
|
|
@@ -3298,8 +3274,7 @@ class kn extends Fe {
|
|
|
3298
3274
|
* 根据数据直接绘制
|
|
3299
3275
|
*/
|
|
3300
3276
|
draw(e, t = !1) {
|
|
3301
|
-
if (this.disposed)
|
|
3302
|
-
return;
|
|
3277
|
+
if (this.disposed) return;
|
|
3303
3278
|
const n = this;
|
|
3304
3279
|
this.css3dTags = this.css3dTags || [];
|
|
3305
3280
|
const a = {
|
|
@@ -3323,36 +3298,35 @@ class kn extends Fe {
|
|
|
3323
3298
|
}, o = n.geometry, s = n.material, r = new pt();
|
|
3324
3299
|
r.setPositions([...a.points]);
|
|
3325
3300
|
const c = new Xe({ color: a.lineColor, linewidth: a.lineWidth });
|
|
3326
|
-
c.resolution.set(innerWidth, innerHeight), n.copy(new
|
|
3327
|
-
const u = a.name,
|
|
3301
|
+
c.resolution.set(innerWidth, innerHeight), n.copy(new Re(r, c)), o?.dispose(), s?.dispose();
|
|
3302
|
+
const u = a.name, d = a.points.length / 3 - 1;
|
|
3328
3303
|
if (!n.css3dMainTag) {
|
|
3329
3304
|
const f = document.createElement("div");
|
|
3330
3305
|
f.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
3331
3306
|
<span class="${u}-main-tag" style="color:${a.mainTagColor};background:${a.mainTagBackground};opacity:${a.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${a.title}</span>
|
|
3332
3307
|
</div>`, f.classList.add("mark-wrap-plans", `${a.name}`, "main-warp"), f.style.position = "absolute", f.style.borderRadius = "4px", f.style.cursor = "pointer", f.onclick = () => {
|
|
3333
|
-
if (n.events.fire(_).markMode)
|
|
3334
|
-
return;
|
|
3308
|
+
if (n.events.fire(_).markMode) return;
|
|
3335
3309
|
const y = parent?.onActiveMark, g = n.getMarkData(!0);
|
|
3336
3310
|
g.meterScale = n.events.fire(_).meterScale, y?.(g), n.events.fire(q);
|
|
3337
3311
|
}, f.oncontextmenu = (y) => y.preventDefault();
|
|
3338
3312
|
const p = new ie(f);
|
|
3339
3313
|
p.position.set(a.points[0], a.points[1], a.points[2]), p.element.style.pointerEvents = "none", p.scale.set(0.01, 0.01, 0.01), p.visible = a.mainTagVisible, n.group.add(p), n.css3dMainTag = p;
|
|
3340
3314
|
}
|
|
3341
|
-
const
|
|
3315
|
+
const l = n.events.fire(dn, a.points).toFixed(2) + " m²", h = n.events.fire(ln, a.points);
|
|
3342
3316
|
if (n.css3dAreaTag)
|
|
3343
|
-
n.css3dAreaTag.position.copy(h), n.css3dAreaTag.element.childNodes[0].innerText =
|
|
3317
|
+
n.css3dAreaTag.position.copy(h), n.css3dAreaTag.element.childNodes[0].innerText = l;
|
|
3344
3318
|
else {
|
|
3345
3319
|
const f = document.createElement("div");
|
|
3346
|
-
f.innerHTML = `<span class="${u}-area-tag" style="color:${a.areaTagColor};background:${a.areaTagBackground};opacity:${a.areaTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: none;">${
|
|
3320
|
+
f.innerHTML = `<span class="${u}-area-tag" style="color:${a.areaTagColor};background:${a.areaTagBackground};opacity:${a.areaTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: none;">${l}</span>`, f.classList.add("mark-wrap-plans", `${a.name}`, "area-warp"), f.style.position = "absolute", f.style.borderRadius = "4px";
|
|
3347
3321
|
const p = new ie(f);
|
|
3348
3322
|
p.position.copy(h), p.element.style.pointerEvents = "none", p.scale.set(0.01, 0.01, 0.01), n.group.add(p), n.css3dAreaTag = p;
|
|
3349
3323
|
}
|
|
3350
3324
|
n.css3dAreaTag.visible = a.points.length > 6 && a.areaTagVisible;
|
|
3351
|
-
for (let f = n.css3dTags.length; f <
|
|
3325
|
+
for (let f = n.css3dTags.length; f < d; f++) {
|
|
3352
3326
|
const p = new C().fromArray(a.points.slice(f * 3, f * 3 + 3)), y = new C().fromArray(a.points.slice(f * 3 + 3, f * 3 + 6)), g = new C((p.x + y.x) / 2, (p.y + y.y) / 2, (p.z + y.z) / 2), x = (p.distanceTo(y) * n.events.fire(_).meterScale).toFixed(2) + " m", b = document.createElement("div");
|
|
3353
3327
|
b.innerText = x, b.style.color = "white", b.classList.add("mark-wrap-plans", `${u}`, "distance-warp"), b.style.position = "absolute", b.style.borderRadius = "4px", b.style.display = "none";
|
|
3354
|
-
const
|
|
3355
|
-
|
|
3328
|
+
const v = new ie(b);
|
|
3329
|
+
v.position.copy(g), v.element.style.pointerEvents = "none", v.scale.set(8e-3, 8e-3, 8e-3), v.visible = a.distanceTagVisible, n.css3dTags.push(v), n.group.add(v);
|
|
3356
3330
|
}
|
|
3357
3331
|
n.drawPlans(a), t || (n.css3dTags[n.css3dTags.length - 1].visible = !1), n.data = a, n.events.fire(Me, n);
|
|
3358
3332
|
}
|
|
@@ -3387,13 +3361,12 @@ class kn extends Fe {
|
|
|
3387
3361
|
return e ? delete t.points : t.points = [...t.points], t;
|
|
3388
3362
|
}
|
|
3389
3363
|
dispose() {
|
|
3390
|
-
if (this.disposed)
|
|
3391
|
-
return;
|
|
3364
|
+
if (this.disposed) return;
|
|
3392
3365
|
const e = this;
|
|
3393
3366
|
e.disposed = !0, e.events.fire(ke, e), e.events.fire(B).remove(e), e.events.fire(Ze, e), e.geometry.dispose(), e.material.dispose(), document.querySelectorAll(`.${e.data.name}`).forEach((n) => n.parentElement?.removeChild(n)), e.events = null, e.data = null, e.css3dTags = null, e.group = null, e.meshPlans = null, e.css3dMainTag = null, e.css3dAreaTag = null;
|
|
3394
3367
|
}
|
|
3395
3368
|
}
|
|
3396
|
-
class sa extends
|
|
3369
|
+
class sa extends Qt {
|
|
3397
3370
|
constructor(e) {
|
|
3398
3371
|
super(), this.isMark = !0, this.disposed = !1, this.events = e;
|
|
3399
3372
|
}
|
|
@@ -3401,8 +3374,7 @@ class sa extends Ht {
|
|
|
3401
3374
|
* 绘制开始
|
|
3402
3375
|
*/
|
|
3403
3376
|
drawStart(e, t) {
|
|
3404
|
-
if (this.disposed)
|
|
3405
|
-
return;
|
|
3377
|
+
if (this.disposed) return;
|
|
3406
3378
|
const n = this, a = document.querySelectorAll(".mark-wrap-circle.main-warp").length + 1, o = {
|
|
3407
3379
|
type: "MarkCirclePlan",
|
|
3408
3380
|
name: t || "circle" + Date.now(),
|
|
@@ -3425,28 +3397,26 @@ class sa extends Ht {
|
|
|
3425
3397
|
c.position.copy(e), c.isMark = !0, c.renderOrder = 1;
|
|
3426
3398
|
const u = new C(0, 1, 0).normalize();
|
|
3427
3399
|
c.lookAt(c.position.clone().add(u));
|
|
3428
|
-
const
|
|
3429
|
-
|
|
3400
|
+
const d = document.createElement("div");
|
|
3401
|
+
d.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
3430
3402
|
<span class="${o.name}-main-tag" style="color:${o.mainTagColor};background:${o.mainTagBackground};opacity:${o.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;user-select: none;font-size: 12px;pointer-events: auto;">${o.title}</span>
|
|
3431
|
-
</div>`,
|
|
3432
|
-
if (n.events.fire(_).markMode)
|
|
3433
|
-
return;
|
|
3403
|
+
</div>`, d.classList.add("mark-wrap-circle", `${o.name}`, "main-warp"), d.style.position = "absolute", d.style.borderRadius = "4px", d.style.cursor = "pointer", d.onclick = () => {
|
|
3404
|
+
if (n.events.fire(_).markMode) return;
|
|
3434
3405
|
const p = parent?.onActiveMark;
|
|
3435
3406
|
p?.(n.getMarkData(!0)), n.events.fire(q);
|
|
3436
|
-
},
|
|
3437
|
-
const
|
|
3438
|
-
|
|
3407
|
+
}, d.oncontextmenu = (p) => p.preventDefault();
|
|
3408
|
+
const l = new ie(d);
|
|
3409
|
+
l.position.copy(e), l.element.style.pointerEvents = "none", l.scale.set(0.01, 0.01, 0.01), l.visible = o.mainTagVisible;
|
|
3439
3410
|
const h = document.createElement("div");
|
|
3440
3411
|
h.innerHTML = `<span class="${t}-circle-tag" style="color:${o.circleTagColor};background:${o.circleTagBackground};opacity:${o.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;"></span>`, h.classList.add("mark-wrap-circle", `${t}`, "circle-warp"), h.style.position = "absolute", h.style.borderRadius = "4px", h.style.pointerEvents = "none";
|
|
3441
3412
|
const f = new ie(h);
|
|
3442
|
-
f.position.set(e.x + Math.min(o.radius / 2, 0.5), e.y, e.z), f.element.style.pointerEvents = "none", f.scale.set(8e-3, 8e-3, 8e-3), f.visible = !1, n.add(c,
|
|
3413
|
+
f.position.set(e.x + Math.min(o.radius / 2, 0.5), e.y, e.z), f.element.style.pointerEvents = "none", f.scale.set(8e-3, 8e-3, 8e-3), f.visible = !1, n.add(c, l, f), n.data = o, n.circleMesh = c, n.css3dTag = f, n.css3dMainTag = l, n.events.fire(Me, n);
|
|
3443
3414
|
}
|
|
3444
3415
|
/**
|
|
3445
3416
|
* 绘制更新
|
|
3446
3417
|
*/
|
|
3447
3418
|
drawUpdate(e, t = !0, n) {
|
|
3448
|
-
if (this.disposed)
|
|
3449
|
-
return;
|
|
3419
|
+
if (this.disposed) return;
|
|
3450
3420
|
const a = this;
|
|
3451
3421
|
if (n) {
|
|
3452
3422
|
const o = new C().fromArray(a.data.startPoint), s = o.distanceTo(new C(n.x, o.y, n.z));
|
|
@@ -3473,8 +3443,7 @@ class sa extends Ht {
|
|
|
3473
3443
|
* 绘制结束
|
|
3474
3444
|
*/
|
|
3475
3445
|
drawFinish(e) {
|
|
3476
|
-
if (this.disposed)
|
|
3477
|
-
return;
|
|
3446
|
+
if (this.disposed) return;
|
|
3478
3447
|
const t = this, n = new C().fromArray(t.data.startPoint), a = n.distanceTo(new C(e.x, n.y, e.z));
|
|
3479
3448
|
t.data.radius = a, t.circleMesh.geometry.copy(new De(a, 128));
|
|
3480
3449
|
const o = t.data.radius * t.events.fire(_).meterScale, s = (Math.PI * o * o).toFixed(2) + " m²";
|
|
@@ -3486,8 +3455,7 @@ class sa extends Ht {
|
|
|
3486
3455
|
* 根据数据直接绘制
|
|
3487
3456
|
*/
|
|
3488
3457
|
draw(e) {
|
|
3489
|
-
if (this.disposed)
|
|
3490
|
-
return;
|
|
3458
|
+
if (this.disposed) return;
|
|
3491
3459
|
const t = this, n = {
|
|
3492
3460
|
type: "MarkCirclePlan",
|
|
3493
3461
|
name: e.name || "circle" + Date.now(),
|
|
@@ -3514,25 +3482,23 @@ class sa extends Ht {
|
|
|
3514
3482
|
u.innerHTML = `<div style='flex-direction: column;align-items: center;display: flex;pointer-events: none;margin-bottom: 40px;'>
|
|
3515
3483
|
<span class="${c}-main-tag" style="color:${n.mainTagColor};background:${n.mainTagBackground};opacity:${n.mainTagOpacity};padding:1px 5px 2px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: auto;">${n.title}</span>
|
|
3516
3484
|
</div>`, u.classList.add("mark-wrap-circle", `${n.name}`, "main-warp"), u.style.position = "absolute", u.style.borderRadius = "4px", u.style.cursor = "pointer", u.onclick = () => {
|
|
3517
|
-
if (t.events.fire(_).markMode)
|
|
3518
|
-
return;
|
|
3485
|
+
if (t.events.fire(_).markMode) return;
|
|
3519
3486
|
const g = parent?.onActiveMark;
|
|
3520
3487
|
g?.(t.getMarkData(!0)), t.events.fire(q);
|
|
3521
3488
|
}, u.oncontextmenu = (g) => g.preventDefault();
|
|
3522
|
-
const
|
|
3523
|
-
f.position.copy(
|
|
3489
|
+
const d = new C().fromArray(n.startPoint), l = n.radius * t.events.fire(_).meterScale, h = (Math.PI * l * l).toFixed(2) + " m²", f = new ie(u);
|
|
3490
|
+
f.position.copy(d), f.element.style.pointerEvents = "none", f.scale.set(0.01, 0.01, 0.01), f.visible = n.mainTagVisible;
|
|
3524
3491
|
const p = document.createElement("div");
|
|
3525
3492
|
p.innerHTML = `<span class="${c}-distance-tag ${c}-circle-tag" style="color:${n.circleTagColor};background:${n.circleTagBackground};opacity:${n.circleTagOpacity};padding: 1px 5px;border-radius: 4px;margin-bottom: 5px;user-select: none;font-size: 12px;pointer-events: none;">${h}</span>`, p.classList.add("mark-wrap-circle", `${c}`, "circle-warp"), p.style.position = "absolute", p.style.borderRadius = "4px", p.style.pointerEvents = "none";
|
|
3526
3493
|
const y = new ie(p);
|
|
3527
|
-
y.position.set(
|
|
3494
|
+
y.position.set(d.x + Math.min(n.radius / 2, 0.5), d.y, d.z), y.element.style.pointerEvents = "none", y.scale.set(8e-3, 8e-3, 8e-3), y.visible = n.circleTagVisible, t.add(s, f, y), t.data = n, t.circleMesh = s, t.css3dTag = y, t.css3dMainTag = f, t.events.fire(Me, t);
|
|
3528
3495
|
}
|
|
3529
3496
|
getMarkData(e = !1) {
|
|
3530
3497
|
const t = { ...this.data };
|
|
3531
3498
|
return e ? (delete t.startPoint, delete t.radius) : t.startPoint = [...t.startPoint], t;
|
|
3532
3499
|
}
|
|
3533
3500
|
dispose() {
|
|
3534
|
-
if (this.disposed)
|
|
3535
|
-
return;
|
|
3501
|
+
if (this.disposed) return;
|
|
3536
3502
|
const e = this;
|
|
3537
3503
|
e.disposed = !0, e.events.fire(ke, e), e.events.fire(B).remove(e), e.events.fire(Ze, e), document.querySelectorAll(`.${e.data.name}`).forEach((n) => n.parentElement?.removeChild(n)), e.events = null, e.data = null, e.circleMesh = null, e.css3dTag = null, e.css3dMainTag = null;
|
|
3538
3504
|
}
|
|
@@ -3542,224 +3508,228 @@ let wr = class {
|
|
|
3542
3508
|
this.down = 0, this.move = !1, this.downTime = 0, this.isDbClick = !1, this.x = 0, this.y = 0, this.lastClickX = 0, this.lastClickY = 0, this.lastClickPointTime = 0, this.lastMovePoint = null, this.lastMovePointTime = 0;
|
|
3543
3509
|
}
|
|
3544
3510
|
};
|
|
3545
|
-
function
|
|
3546
|
-
const e = (
|
|
3511
|
+
function vr(i) {
|
|
3512
|
+
const e = (S, D, E) => i.on(S, D, E), t = (S, ...D) => i.fire(S, ...D), n = t(Ke);
|
|
3547
3513
|
let a = /* @__PURE__ */ new Set(), o, s = new wr(), r;
|
|
3548
3514
|
e(oi, () => {
|
|
3549
3515
|
t(Y).autoRotate = t(_).autoRotate = !0;
|
|
3550
|
-
}), e(q, (
|
|
3551
|
-
t(Y).autoRotate = t(_).autoRotate = !1,
|
|
3552
|
-
}), e(
|
|
3553
|
-
if (o)
|
|
3554
|
-
|
|
3555
|
-
const D = t(Y), k = v ? Math.PI / 128 : -(Math.PI / 128), M = new Ke().makeRotationAxis(new C(0, 0, -1).transformDirection(D.object.matrixWorld), k);
|
|
3516
|
+
}), e(q, (S = !0) => {
|
|
3517
|
+
t(Y).autoRotate = t(_).autoRotate = !1, S && t(zt);
|
|
3518
|
+
}), e(Kt, (S = !0) => {
|
|
3519
|
+
if (o) return;
|
|
3520
|
+
const D = t(Y), E = S ? Math.PI / 128 : -(Math.PI / 128), M = new $e().makeRotationAxis(new C(0, 0, -1).transformDirection(D.object.matrixWorld), E);
|
|
3556
3521
|
D.object.up.transformDirection(M), t(J);
|
|
3557
3522
|
}), e(yi, () => {
|
|
3558
|
-
o || i.fire(
|
|
3523
|
+
o || i.fire(Kt, !0);
|
|
3559
3524
|
}), e(Ai, () => {
|
|
3560
|
-
o || i.fire(
|
|
3561
|
-
}), e(
|
|
3525
|
+
o || i.fire(Kt, !1);
|
|
3526
|
+
}), e(Bt, (S) => {
|
|
3562
3527
|
const D = t(_);
|
|
3563
|
-
|
|
3564
|
-
}), e(
|
|
3565
|
-
t(B).traverse((D) => D instanceof pe && D.fire(
|
|
3566
|
-
}), e(rt, (
|
|
3567
|
-
t(B).traverse((
|
|
3528
|
+
S ?? (S = !D.pointcloudMode), D.pointcloudMode = S, t(B).traverse((M) => M instanceof pe && M.fire(nt, S));
|
|
3529
|
+
}), e(Ut, () => {
|
|
3530
|
+
t(B).traverse((D) => D instanceof pe && D.fire(fn));
|
|
3531
|
+
}), e(rt, (S) => {
|
|
3532
|
+
t(B).traverse((E) => E instanceof pe && E.fire(rt, S));
|
|
3568
3533
|
}), e(Ci, () => {
|
|
3569
|
-
const
|
|
3534
|
+
const S = t(B);
|
|
3570
3535
|
let D;
|
|
3571
|
-
|
|
3572
|
-
}), e(
|
|
3573
|
-
if (!a.size)
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
if (
|
|
3577
|
-
return a.clear();
|
|
3578
|
-
if (v.markMode && a.has("Escape")) {
|
|
3536
|
+
S.traverse((E) => E instanceof pe && (D = E)), D && t(un, D.fire(Ys));
|
|
3537
|
+
}), e(Wt, () => {
|
|
3538
|
+
if (!a.size) return;
|
|
3539
|
+
const S = t(_);
|
|
3540
|
+
if (!S.enableKeyboard) return a.clear();
|
|
3541
|
+
if (S.markMode && a.has("Escape")) {
|
|
3579
3542
|
t(qe), a.clear();
|
|
3580
3543
|
return;
|
|
3581
3544
|
}
|
|
3582
|
-
a.has("Space") ? (
|
|
3583
|
-
}), e(it, async (
|
|
3584
|
-
if (s.move)
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
D[k].fire(Mt, 0, 0, 0, !1);
|
|
3545
|
+
a.has("Space") ? (S.bigSceneMode ? t(Bt) : t(Ut), a.clear()) : a.has("KeyR") ? (S.autoRotate ? t(q) : t(oi), a.clear()) : a.has("KeyM") ? (t(dt, !S.markVisible), a.clear()) : a.has("ArrowLeft") ? (t(yi), t(Tt, !0), a.clear()) : a.has("ArrowRight") ? (t(Ai), t(Tt, !0), a.clear()) : a.has("KeyP") ? (t(Ot, !0), a.clear()) : a.has("Equal") ? (t(Hn), a.clear()) : a.has("Minus") ? (t(Wn), a.clear()) : a.has("KeyY") ? (t(yn), a.clear()) : a.has("KeyI") ? (t(Os), a.clear()) : a.has("KeyF") ? (t(Ci), a.clear()) : a.has("F2") && (!S.bigSceneMode && window.open("/editor/index.html?url=" + encodeURIComponent(t(ye).meta.url)), a.clear());
|
|
3546
|
+
}), e(it, async (S, D) => {
|
|
3547
|
+
if (s.move) return;
|
|
3548
|
+
const E = await t(Ft, S, D);
|
|
3549
|
+
E.length && t(un, E[0], !0);
|
|
3550
|
+
}), e(ce, async (S, D) => {
|
|
3551
|
+
const E = t(B), M = [];
|
|
3552
|
+
E.traverse((k) => k instanceof pe && M.push(k));
|
|
3553
|
+
const F = await t(Ft, S, D);
|
|
3554
|
+
return F.length ? (M.length && M[0].fire(Ct, F[0].x, F[0].y, F[0].z, !0), new C(F[0].x, F[0].y, F[0].z)) : (M.length && M[0].fire(Ct, 0, 0, 0, !1), null);
|
|
3555
|
+
}), e(Bn, async () => {
|
|
3556
|
+
const S = t(B), D = [];
|
|
3557
|
+
S.traverse((E) => E instanceof pe && D.push(E));
|
|
3558
|
+
for (let E = 0; E < D.length; E++)
|
|
3559
|
+
D[E].fire(Ct, 0, 0, 0, !1);
|
|
3598
3560
|
});
|
|
3599
|
-
const c = (
|
|
3600
|
-
|
|
3601
|
-
}, u = (
|
|
3602
|
-
|
|
3561
|
+
const c = (S) => {
|
|
3562
|
+
S.target.type !== "text" && (o || S.code === "F5" || (S.preventDefault(), S.code !== "KeyR" && (a.add(S.code), t(q)), r = Date.now()));
|
|
3563
|
+
}, u = (S) => {
|
|
3564
|
+
S.target.type !== "text" && (o || (S.code === "KeyR" && a.add(S.code), (S.code === "ArrowLeft" || S.code === "ArrowRight") && t(us), r = Date.now()));
|
|
3603
3565
|
};
|
|
3604
|
-
e(
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3566
|
+
e(
|
|
3567
|
+
Oe,
|
|
3568
|
+
() => {
|
|
3569
|
+
t(Un) && Date.now() - r > 2e3 && (t(Tt, !1), t(yn));
|
|
3570
|
+
},
|
|
3571
|
+
!0
|
|
3572
|
+
);
|
|
3573
|
+
const d = () => {
|
|
3608
3574
|
a.clear();
|
|
3609
|
-
},
|
|
3610
|
-
parent && setTimeout(() => window.focus()),
|
|
3611
|
-
}, h = (
|
|
3612
|
-
|
|
3575
|
+
}, l = (S) => {
|
|
3576
|
+
parent && setTimeout(() => window.focus()), S.preventDefault(), !o && (t(q), r = Date.now());
|
|
3577
|
+
}, h = (S) => {
|
|
3578
|
+
S.preventDefault(), !o && (t(q), r = Date.now());
|
|
3613
3579
|
};
|
|
3614
3580
|
let f, p, y, g;
|
|
3615
3581
|
e(qe, () => {
|
|
3616
3582
|
f?.dispose(), p?.dispose(), y?.dispose(), g?.dispose(), f = null, p = null, y = null, g = null, s.lastMovePoint = null, t(Te);
|
|
3617
3583
|
});
|
|
3618
|
-
const m = async (
|
|
3619
|
-
parent && setTimeout(() => window.focus()),
|
|
3620
|
-
}, x = async (
|
|
3621
|
-
if (
|
|
3622
|
-
return;
|
|
3584
|
+
const m = async (S) => {
|
|
3585
|
+
parent && setTimeout(() => window.focus()), S.preventDefault(), !o && (t(q), s.down = S.button === 2 ? 2 : 1, s.move = !1, s.isDbClick = Date.now() - s.downTime < 300, r = Date.now(), s.downTime = Date.now());
|
|
3586
|
+
}, x = async (S) => {
|
|
3587
|
+
if (S.preventDefault(), o) return;
|
|
3623
3588
|
s.down && (s.move = !0, r = Date.now());
|
|
3624
3589
|
const D = t(_);
|
|
3625
3590
|
if (D.markMode) {
|
|
3626
|
-
const
|
|
3627
|
-
|
|
3591
|
+
const E = await t(ce, S.clientX, S.clientY);
|
|
3592
|
+
E && !s.down && D.markType === "distance" && f ? f.drawUpdate({ endPoint: E.toArray() }) : !s.down && D.markType === "circle" && g ? E ? (g.drawUpdate(null, !0, E), s.lastMovePoint = E, s.lastMovePointTime = Date.now()) : (s.lastMovePoint = null, s.lastMovePointTime = 0) : !s.down && D.markType === "lines" && p ? E ? (p.drawUpdate(null, !0, E), s.lastMovePoint = E, s.lastMovePointTime = Date.now()) : (s.lastMovePoint = null, s.lastMovePointTime = 0) : !s.down && D.markType === "plans" && y && (E ? (y.drawUpdate(null, !0, E), s.lastMovePoint = E, s.lastMovePointTime = Date.now()) : (s.lastMovePoint = null, s.lastMovePointTime = 0));
|
|
3628
3593
|
}
|
|
3629
|
-
}, b = async (
|
|
3630
|
-
if (
|
|
3631
|
-
return;
|
|
3594
|
+
}, b = async (S) => {
|
|
3595
|
+
if (S.preventDefault(), o) return;
|
|
3632
3596
|
const D = t(_);
|
|
3633
|
-
if (s.isDbClick && (p ? Math.abs(
|
|
3597
|
+
if (s.isDbClick && (p ? Math.abs(S.clientX - s.lastClickX) < 2 && Math.abs(S.clientY - s.lastClickY) < 2 && (p.drawFinish(s.lastClickPointTime > 0), p = null, s.lastMovePoint = null) : y && Math.abs(S.clientX - s.lastClickX) < 2 && Math.abs(S.clientY - s.lastClickY) < 2 && (y.drawFinish(s.lastClickPointTime > 0), y = null, s.lastMovePoint = null)), D.markMode && s.down === 1 && !s.move && Date.now() - s.downTime < 500) {
|
|
3634
3598
|
if (D.markType === "point") {
|
|
3635
|
-
if (await t(ce,
|
|
3636
|
-
const M = new ia(i, await t(ce,
|
|
3599
|
+
if (await t(ce, S.clientX, S.clientY)) {
|
|
3600
|
+
const M = new ia(i, await t(ce, S.clientX, S.clientY));
|
|
3637
3601
|
t(B).add(M), M.drawFinish();
|
|
3638
3602
|
}
|
|
3639
3603
|
} else if (D.markType === "distance")
|
|
3640
3604
|
if (f) {
|
|
3641
|
-
const
|
|
3642
|
-
|
|
3605
|
+
const E = await t(ce, S.clientX, S.clientY);
|
|
3606
|
+
E ? (f.drawFinish(E), f = null) : s.isDbClick && t(qe);
|
|
3643
3607
|
} else {
|
|
3644
|
-
const
|
|
3645
|
-
|
|
3608
|
+
const E = await t(ce, S.clientX, S.clientY);
|
|
3609
|
+
E && (f = new Cn(i), f.drawStart(E), t(B).add(f));
|
|
3646
3610
|
}
|
|
3647
3611
|
else if (D.markType === "lines")
|
|
3648
3612
|
if (p)
|
|
3649
|
-
if (s.lastMovePoint && t(
|
|
3613
|
+
if (s.lastMovePoint && t(mn, S.clientX, S.clientY, s.lastMovePoint) < 0.03)
|
|
3650
3614
|
p.drawUpdate(null, !0, s.lastMovePoint, !0), s.lastClickPointTime = Date.now();
|
|
3651
3615
|
else {
|
|
3652
|
-
const
|
|
3653
|
-
|
|
3616
|
+
const E = await t(ce, S.clientX, S.clientY);
|
|
3617
|
+
E ? (p.drawUpdate(null, !0, E, !0), s.lastClickPointTime = Date.now()) : s.lastClickPointTime = 0;
|
|
3654
3618
|
}
|
|
3655
3619
|
else {
|
|
3656
|
-
const
|
|
3657
|
-
|
|
3620
|
+
const E = await t(ce, S.clientX, S.clientY);
|
|
3621
|
+
E && (p = new Mn(i), p.drawStart(E), t(B).add(p));
|
|
3658
3622
|
}
|
|
3659
3623
|
else if (D.markType === "plans")
|
|
3660
3624
|
if (y)
|
|
3661
|
-
if (s.lastMovePoint && t(
|
|
3625
|
+
if (s.lastMovePoint && t(mn, S.clientX, S.clientY, s.lastMovePoint) < 0.03)
|
|
3662
3626
|
y.drawUpdate(null, !0, s.lastMovePoint, !0), s.lastClickPointTime = Date.now();
|
|
3663
3627
|
else {
|
|
3664
|
-
const
|
|
3665
|
-
|
|
3628
|
+
const E = await t(ce, S.clientX, S.clientY);
|
|
3629
|
+
E ? (y.drawUpdate(null, !0, E, !0), s.lastClickPointTime = Date.now()) : s.lastClickPointTime = 0;
|
|
3666
3630
|
}
|
|
3667
3631
|
else {
|
|
3668
|
-
const
|
|
3669
|
-
|
|
3632
|
+
const E = await t(ce, S.clientX, S.clientY);
|
|
3633
|
+
E && (y = new Tn(i), y.drawStart(E), t(B).add(y));
|
|
3670
3634
|
}
|
|
3671
3635
|
else if (D.markType === "circle")
|
|
3672
3636
|
if (g) {
|
|
3673
|
-
const
|
|
3674
|
-
|
|
3637
|
+
const E = await t(ce, S.clientX, S.clientY);
|
|
3638
|
+
E ? (g.drawFinish(E), g = null) : s.isDbClick && t(qe);
|
|
3675
3639
|
} else {
|
|
3676
|
-
const
|
|
3677
|
-
|
|
3640
|
+
const E = await t(ce, S.clientX, S.clientY);
|
|
3641
|
+
E && (g = new sa(i), g.drawStart(E), t(B).add(g));
|
|
3678
3642
|
}
|
|
3679
|
-
s.lastClickX =
|
|
3643
|
+
s.lastClickX = S.clientX, s.lastClickY = S.clientY;
|
|
3680
3644
|
}
|
|
3681
|
-
s.down === 2 && !s.move && t(it,
|
|
3645
|
+
s.down === 2 && !s.move && t(it, S.clientX, S.clientY), s.down = 0, s.move = !1, r = Date.now();
|
|
3682
3646
|
};
|
|
3683
|
-
function S
|
|
3684
|
-
|
|
3647
|
+
function v(S) {
|
|
3648
|
+
S.preventDefault(), !o && (t(q), s.down = S.touches.length, s.down === 1 && (s.move = !1, s.x = S.touches[0].clientX, s.y = S.touches[0].clientY));
|
|
3685
3649
|
}
|
|
3686
|
-
function T(
|
|
3687
|
-
|
|
3650
|
+
function T(S) {
|
|
3651
|
+
S.touches.length === 1 && (s.move = !0);
|
|
3688
3652
|
}
|
|
3689
|
-
function w(
|
|
3653
|
+
function w(S) {
|
|
3690
3654
|
s.down === 1 && !s.move && t(it, s.x, s.y);
|
|
3691
3655
|
}
|
|
3692
|
-
window.addEventListener("keydown", c), window.addEventListener("keyup", u), window.addEventListener("blur",
|
|
3656
|
+
window.addEventListener("keydown", c), window.addEventListener("keyup", u), window.addEventListener("blur", d), window.addEventListener("wheel", l, { passive: !1 }), n.addEventListener("contextmenu", h), n.addEventListener("mousedown", m), n.addEventListener("mousemove", x), n.addEventListener("mouseup", b), n.addEventListener("touchstart", v, { passive: !1 }), n.addEventListener("touchmove", T, { passive: !1 }), n.addEventListener("touchend", w, { passive: !1 }), window.addEventListener("resize", I), I();
|
|
3693
3657
|
function I() {
|
|
3694
|
-
const { width:
|
|
3695
|
-
|
|
3696
|
-
const
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3658
|
+
const { width: S, height: D, top: E, left: M } = t(Ue), F = t(V);
|
|
3659
|
+
F.aspect = S / D, F.updateProjectionMatrix();
|
|
3660
|
+
const k = t(On);
|
|
3661
|
+
k.setSize(S, D), k.domElement.style.position = "absolute", k.domElement.style.left = `${M}px`, k.domElement.style.top = `${E}px`;
|
|
3662
|
+
const P = t(ct);
|
|
3663
|
+
P.setPixelRatio(Math.min(devicePixelRatio, 2)), P.setSize(S, D);
|
|
3664
|
+
}
|
|
3665
|
+
e(Ln, () => {
|
|
3666
|
+
o = !0, window.removeEventListener("keydown", c), window.removeEventListener("keyup", u), window.removeEventListener("blur", d), window.removeEventListener("wheel", l), n.removeEventListener("contextmenu", h), n.removeEventListener("mousedown", m), n.removeEventListener("mousemove", x), n.removeEventListener("mouseup", b), n.removeEventListener("touchstart", v), n.removeEventListener("touchmove", T), n.removeEventListener("touchend", w), window.removeEventListener("resize", I);
|
|
3701
3667
|
});
|
|
3702
3668
|
}
|
|
3703
3669
|
function aa(i) {
|
|
3704
3670
|
const e = new Aa(), t = 0.02, n = (o, s, r) => i.on(o, s, r), a = (o, ...s) => i.fire(o, ...s);
|
|
3705
3671
|
n(Ft, async (o, s) => {
|
|
3706
|
-
const { width: r, height: c, left: u, top:
|
|
3707
|
-
|
|
3672
|
+
const { width: r, height: c, left: u, top: d } = a(Ue), l = new j();
|
|
3673
|
+
l.x = (o - u) / r * 2 - 1, l.y = (d - s) / c * 2 + 1;
|
|
3708
3674
|
const h = a(V);
|
|
3709
|
-
e.setFromCamera(
|
|
3675
|
+
e.setFromCamera(l, h);
|
|
3710
3676
|
const f = [], p = a(B), y = [], g = [];
|
|
3711
|
-
p.traverse(function(
|
|
3712
|
-
|
|
3677
|
+
p.traverse(function(v) {
|
|
3678
|
+
v instanceof pe ? g.push(v) : v.isMesh && !v.ignoreIntersect && !v.isMark && y.push(v);
|
|
3713
3679
|
});
|
|
3714
3680
|
const m = e.intersectObjects(y, !0);
|
|
3715
|
-
for (let
|
|
3716
|
-
f.push(new tt(m[
|
|
3681
|
+
for (let v = 0; v < m.length; v++)
|
|
3682
|
+
f.push(new tt(m[v].point, e.ray.distanceToPoint(m[v].point)));
|
|
3717
3683
|
const x = h.projectionMatrix.clone().multiply(h.matrixWorldInverse);
|
|
3718
|
-
for (let
|
|
3719
|
-
const T = g[
|
|
3684
|
+
for (let v = 0; v < g.length; v++) {
|
|
3685
|
+
const T = g[v].fire(gn);
|
|
3720
3686
|
if (T)
|
|
3721
3687
|
if (T.length !== void 0) {
|
|
3722
3688
|
const w = T, I = w.length / 3;
|
|
3723
|
-
for (let
|
|
3724
|
-
const D = new C(w[3 *
|
|
3725
|
-
Math.sqrt((M -
|
|
3689
|
+
for (let S = 0; S < I; S++) {
|
|
3690
|
+
const D = new C(w[3 * S + 0], w[3 * S + 1], w[3 * S + 2]), E = new ve(D.x, D.y, D.z, 1).applyMatrix4(x), M = E.x / E.w, F = E.y / E.w;
|
|
3691
|
+
Math.sqrt((M - l.x) ** 2 + (F - l.y) ** 2) <= t && f.push(new tt(D, e.ray.distanceToPoint(D)));
|
|
3726
3692
|
}
|
|
3727
3693
|
} else
|
|
3728
3694
|
for (let w of Object.keys(T)) {
|
|
3729
|
-
const I = w.split(","),
|
|
3730
|
-
if (e.ray.distanceToPoint(
|
|
3695
|
+
const I = w.split(","), S = new C(Number(I[0]), Number(I[1]), Number(I[2]));
|
|
3696
|
+
if (e.ray.distanceToPoint(S) <= 1.4143) {
|
|
3731
3697
|
const D = T[w];
|
|
3732
|
-
for (let
|
|
3733
|
-
const
|
|
3734
|
-
Math.sqrt((P -
|
|
3698
|
+
for (let E = 0, M = D.length / 3; E < M; E++) {
|
|
3699
|
+
const F = new C(D[3 * E + 0], D[3 * E + 1], D[3 * E + 2]), k = new ve(F.x, F.y, F.z, 1).applyMatrix4(x), P = k.x / k.w, U = k.y / k.w;
|
|
3700
|
+
Math.sqrt((P - l.x) ** 2 + (U - l.y) ** 2) <= t && f.push(new tt(F, e.ray.distanceToPoint(F)));
|
|
3735
3701
|
}
|
|
3736
3702
|
}
|
|
3737
3703
|
}
|
|
3738
3704
|
}
|
|
3739
|
-
f.sort((
|
|
3705
|
+
f.sort((v, T) => v.radius - T.radius);
|
|
3740
3706
|
const b = [];
|
|
3741
|
-
for (let
|
|
3742
|
-
b.push(f[
|
|
3707
|
+
for (let v = 0; v < f.length; v++)
|
|
3708
|
+
b.push(f[v].center);
|
|
3743
3709
|
return b;
|
|
3744
|
-
}), n(
|
|
3745
|
-
const { width: c, height: u, left:
|
|
3746
|
-
h.x = (o -
|
|
3710
|
+
}), n(mn, (o, s, r) => {
|
|
3711
|
+
const { width: c, height: u, left: d, top: l } = a(Ue), h = new j();
|
|
3712
|
+
h.x = (o - d) / c * 2 - 1, h.y = (l - s) / u * 2 + 1;
|
|
3747
3713
|
const f = a(V);
|
|
3748
3714
|
return e.setFromCamera(h, f), e.ray.distanceToPoint(r);
|
|
3749
3715
|
});
|
|
3750
3716
|
}
|
|
3751
|
-
function
|
|
3717
|
+
function Sr(i) {
|
|
3752
3718
|
const e = (r, c, u) => i.on(r, c, u), t = (r, ...c) => i.fire(r, ...c);
|
|
3753
|
-
e(ft, () => t(V).fov), e(Be, (r = !1) => r ? t(V).position.clone() : t(V).position), e(Ce, (r = !1) => r ? t(Y).target.clone() : t(Y).target), e(Ne, (r = !1) => r ? t(V).up.clone() : t(V).up), e(
|
|
3719
|
+
e(ft, () => t(V).fov), e(Be, (r = !1) => r ? t(V).position.clone() : t(V).position), e(Ce, (r = !1) => r ? t(Y).target.clone() : t(Y).target), e(Ne, (r = !1) => r ? t(V).up.clone() : t(V).up), e(un, (r, c = !1) => {
|
|
3754
3720
|
if (t(Is, r), !c) {
|
|
3755
|
-
t(Y).target.copy(r), t(
|
|
3721
|
+
t(Y).target.copy(r), t(Rt);
|
|
3756
3722
|
return;
|
|
3757
3723
|
}
|
|
3758
3724
|
const u = t(Y).target.clone();
|
|
3759
|
-
let
|
|
3760
|
-
t(
|
|
3761
|
-
|
|
3762
|
-
|
|
3725
|
+
let d = 0;
|
|
3726
|
+
t(
|
|
3727
|
+
at,
|
|
3728
|
+
() => {
|
|
3729
|
+
d += 0.03, t(Y).target.copy(u.clone().lerp(r, d)), t(Rt);
|
|
3730
|
+
},
|
|
3731
|
+
() => d < 1
|
|
3732
|
+
);
|
|
3763
3733
|
}), e(ls, () => {
|
|
3764
3734
|
let r = t(Be).toArray(), c = t(Ne).toArray(), u = t(Ce).toArray();
|
|
3765
3735
|
return { position: r, lookUp: c, lookAt: u };
|
|
@@ -3767,8 +3737,8 @@ function vr(i) {
|
|
|
3767
3737
|
const n = 0.01;
|
|
3768
3738
|
let a = new C(), o = new C(), s = 0;
|
|
3769
3739
|
e(ws, () => {
|
|
3770
|
-
const r = t(Y).object, c = r.fov, u = r.position.clone(),
|
|
3771
|
-
return Math.abs(s - c) < n && Math.abs(u.x - a.x) < n && Math.abs(u.y - a.y) < n && Math.abs(u.z - a.z) < n && Math.abs(
|
|
3740
|
+
const r = t(Y).object, c = r.fov, u = r.position.clone(), d = r.getWorldDirection(new C());
|
|
3741
|
+
return Math.abs(s - c) < n && Math.abs(u.x - a.x) < n && Math.abs(u.y - a.y) < n && Math.abs(u.z - a.z) < n && Math.abs(d.x - o.x) < n && Math.abs(d.y - o.y) < n && Math.abs(d.z - o.z) < n ? !1 : (s = c, a = u, o = d, !0);
|
|
3772
3742
|
});
|
|
3773
3743
|
}
|
|
3774
3744
|
class br extends te {
|
|
@@ -3778,54 +3748,56 @@ class br extends te {
|
|
|
3778
3748
|
}
|
|
3779
3749
|
function xr(i) {
|
|
3780
3750
|
let e = !1;
|
|
3781
|
-
const t = (r, c, u) => i.on(r, c, u), n = (r, ...c) => i.fire(r, ...c), a = [], o = new C(), s = new
|
|
3751
|
+
const t = (r, c, u) => i.on(r, c, u), n = (r, ...c) => i.fire(r, ...c), a = [], o = new C(), s = new $e();
|
|
3782
3752
|
t(_s, () => {
|
|
3783
3753
|
const r = new wa(0.5, 32, 32), c = Cr();
|
|
3784
3754
|
c.depthTest = !1, c.depthWrite = !1, c.transparent = !0;
|
|
3785
3755
|
const u = new br();
|
|
3786
|
-
return u.copy(new te(r, c)), t(Da, () => c), t(wi, (
|
|
3787
|
-
e || (c.uniforms[
|
|
3788
|
-
}), t(Is, (
|
|
3789
|
-
if (e)
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
s.copy(d.matrixWorld).invert(), o.copy(l).applyMatrix4(s), o.normalize().multiplyScalar(10), o.applyMatrix4(d.matrixWorld);
|
|
3756
|
+
return u.copy(new te(r, c)), t(Da, () => c), t(wi, (d) => {
|
|
3757
|
+
e || (c.uniforms[xn].value = d, d <= 0.01 ? u.visible = !1 : u.visible = !0, c.uniformsNeedUpdate = !0, n(J));
|
|
3758
|
+
}), t(Is, (d) => {
|
|
3759
|
+
if (e) return;
|
|
3760
|
+
const l = n(V);
|
|
3761
|
+
s.copy(l.matrixWorld).invert(), o.copy(d).applyMatrix4(s), o.normalize().multiplyScalar(10), o.applyMatrix4(l.matrixWorld);
|
|
3793
3762
|
const { width: h, height: f } = n(Ue);
|
|
3794
|
-
c.uniforms[ht].value.set(h, f), u.position.copy(o), c.uniforms[Js].value.copy(
|
|
3763
|
+
c.uniforms[ht].value.set(h, f), u.position.copy(o), c.uniforms[Js].value.copy(d), c.uniforms[ht].value.set(h, f), c.uniforms[xn].value = 1, c.uniformsNeedUpdate = !0, n(vi), n(J);
|
|
3795
3764
|
}), t(Pa, () => {
|
|
3796
3765
|
e || (e = !0, c.dispose(), r.dispose());
|
|
3797
3766
|
}), u.renderOrder = 99999, u;
|
|
3798
|
-
}), t(
|
|
3799
|
-
for (; a.length; )
|
|
3800
|
-
a.pop().opacity = 0;
|
|
3767
|
+
}), t(vi, () => {
|
|
3768
|
+
for (; a.length; ) a.pop().opacity = 0;
|
|
3801
3769
|
let r = { opacity: 1 };
|
|
3802
|
-
a.push(r), n(
|
|
3803
|
-
|
|
3804
|
-
|
|
3770
|
+
a.push(r), n(
|
|
3771
|
+
Pn,
|
|
3772
|
+
() => {
|
|
3773
|
+
!e && r.opacity > 0 && (r.opacity < 0.2 ? r.opacity = 0 : r.opacity > 0.6 ? r.opacity = Math.max(r.opacity -= 0.01, 0) : r.opacity = Math.max(r.opacity -= 0.03, 0), n(wi, r.opacity));
|
|
3774
|
+
},
|
|
3775
|
+
() => !e && r.opacity > 0
|
|
3776
|
+
);
|
|
3805
3777
|
});
|
|
3806
3778
|
}
|
|
3807
3779
|
function Cr() {
|
|
3808
3780
|
const i = {
|
|
3809
|
-
[
|
|
3781
|
+
[So]: { type: "v3", value: new is() },
|
|
3810
3782
|
[Js]: { type: "v3", value: new C() },
|
|
3811
3783
|
[ht]: { type: "v2", value: new j() },
|
|
3812
|
-
[
|
|
3784
|
+
[xn]: { value: 0 }
|
|
3813
3785
|
};
|
|
3814
|
-
return new
|
|
3786
|
+
return new _n({
|
|
3815
3787
|
uniforms: i,
|
|
3816
3788
|
vertexShader: Ao(),
|
|
3817
3789
|
fragmentShader: wo(),
|
|
3818
3790
|
transparent: !0,
|
|
3819
3791
|
depthTest: !1,
|
|
3820
3792
|
depthWrite: !1,
|
|
3821
|
-
side:
|
|
3793
|
+
side: va
|
|
3822
3794
|
});
|
|
3823
3795
|
}
|
|
3824
3796
|
function oa(i) {
|
|
3825
3797
|
const e = (s, r, c) => i.on(s, r, c), t = (s, ...r) => i.fire(s, ...r), n = /* @__PURE__ */ new Map(), a = document.createElement("div");
|
|
3826
3798
|
a.classList.add("mark-warp"), document.body.appendChild(a);
|
|
3827
3799
|
const o = new Ar();
|
|
3828
|
-
o.setSize(innerWidth, innerHeight), o.domElement.style.position = "absolute", o.domElement.style.top = "0px", o.domElement.style.pointerEvents = "none", a.appendChild(o.domElement), e(
|
|
3800
|
+
o.setSize(innerWidth, innerHeight), o.domElement.style.position = "absolute", o.domElement.style.top = "0px", o.domElement.style.pointerEvents = "none", a.appendChild(o.domElement), e(Ra, () => a), e(On, () => o), e(zn, () => document.body.removeChild(a)), e(Oe, () => o.render(t(B), t(V)), !0), e(Me, (s) => {
|
|
3829
3801
|
const r = s?.getMarkData?.()?.name || s?.name;
|
|
3830
3802
|
r && n.set(r, new WeakRef(s));
|
|
3831
3803
|
}), e(Ze, (s) => {
|
|
@@ -3839,7 +3811,7 @@ function oa(i) {
|
|
|
3839
3811
|
return r ? r.getMarkData?.() : {};
|
|
3840
3812
|
}), e(dt, (s) => {
|
|
3841
3813
|
s !== void 0 && (t(_).markVisible = s), t(B).traverse((r) => r.isMark && (r.visible = t(_).markVisible)), t(J);
|
|
3842
|
-
}), e(
|
|
3814
|
+
}), e(yn, async () => {
|
|
3843
3815
|
const s = [];
|
|
3844
3816
|
t(B).traverse((c) => {
|
|
3845
3817
|
if (c.isMark) {
|
|
@@ -3849,7 +3821,7 @@ function oa(i) {
|
|
|
3849
3821
|
});
|
|
3850
3822
|
const r = t(ye).meta || {};
|
|
3851
3823
|
return s.length ? r.marks = s : delete r.marks, r.cameraInfo = t(ls), await t(Pe, r);
|
|
3852
|
-
}), e(
|
|
3824
|
+
}), e(kt, async () => {
|
|
3853
3825
|
const s = [];
|
|
3854
3826
|
t(B).traverse((c) => {
|
|
3855
3827
|
if (c.isMark) {
|
|
@@ -3864,34 +3836,34 @@ function oa(i) {
|
|
|
3864
3836
|
delete s.marks;
|
|
3865
3837
|
const r = await t(Pe, s), c = [];
|
|
3866
3838
|
return n.forEach((u) => c.push(u)), c.forEach((u) => u.deref()?.dispose?.()), t(J), r;
|
|
3867
|
-
}), e(
|
|
3839
|
+
}), e(Fs, async () => {
|
|
3868
3840
|
t(B).traverse((r) => {
|
|
3869
3841
|
r.isMark && r.getMarkData?.();
|
|
3870
3842
|
});
|
|
3871
3843
|
const s = t(ye).meta || {};
|
|
3872
3844
|
return s.watermark = t(Ds) || "", await t(Pe, s);
|
|
3873
|
-
}), e(
|
|
3845
|
+
}), e(An, (s) => {
|
|
3874
3846
|
s.meterScale && (t(_).meterScale = s.meterScale, t(oe, { scale: `1 : ${t(_).meterScale} m` })), t(Y).updateByOptions({ ...s, ...s.cameraInfo || {} }), (s.marks || []).forEach((c) => {
|
|
3875
3847
|
if (c.type === "MarkSinglePoint") {
|
|
3876
3848
|
const u = new ia(i, c);
|
|
3877
3849
|
u.visible = !1, t(B).add(u);
|
|
3878
3850
|
} else if (c.type === "MarkDistanceLine") {
|
|
3879
|
-
const u = new
|
|
3851
|
+
const u = new Cn(i);
|
|
3880
3852
|
u.draw(c), u.visible = !1, t(B).add(u);
|
|
3881
3853
|
} else if (c.type === "MarkMultiLines") {
|
|
3882
|
-
const u = new
|
|
3854
|
+
const u = new Mn(i);
|
|
3883
3855
|
u.draw(c, !0), u.visible = !1, t(B).add(u);
|
|
3884
3856
|
} else if (c.type === "MarkMultiPlans") {
|
|
3885
|
-
const u = new
|
|
3857
|
+
const u = new Tn(i);
|
|
3886
3858
|
u.draw(c, !0), u.visible = !1, t(B).add(u);
|
|
3887
3859
|
} else if (c.type === "MarkCirclePlan") {
|
|
3888
3860
|
const u = new sa(i);
|
|
3889
3861
|
u.draw(c), u.visible = !1, t(B).add(u);
|
|
3890
3862
|
}
|
|
3891
|
-
}), t(
|
|
3863
|
+
}), t(Yn, s.flyPositions || []), t(Vn, s.flyTargets || []);
|
|
3892
3864
|
}), e(Te, () => {
|
|
3893
3865
|
const s = t(_);
|
|
3894
|
-
s.markMode = !1, t(
|
|
3866
|
+
s.markMode = !1, t(Bn), t(J);
|
|
3895
3867
|
}), e(Ps, (s, r = !0) => {
|
|
3896
3868
|
const c = s?.meterScale;
|
|
3897
3869
|
if (c) {
|
|
@@ -3901,40 +3873,39 @@ function oa(i) {
|
|
|
3901
3873
|
}
|
|
3902
3874
|
r && (t(_).meterScale = s.meterScale), t(oe, { scale: `1 : ${c} m` });
|
|
3903
3875
|
for (const u of n.values()) {
|
|
3904
|
-
const
|
|
3905
|
-
|
|
3876
|
+
const d = u.deref();
|
|
3877
|
+
d && (d instanceof Cn || d instanceof Mn || d instanceof Tn) && d.updateByMeterScale(c);
|
|
3906
3878
|
}
|
|
3907
3879
|
}
|
|
3908
|
-
}), e(
|
|
3909
|
-
const r = new C().fromArray(s.slice(0, 3)), c = new C().fromArray(s.slice(-6, -3)), u = new C().fromArray(s.slice(-3)),
|
|
3880
|
+
}), e(ln, (s) => {
|
|
3881
|
+
const r = new C().fromArray(s.slice(0, 3)), c = new C().fromArray(s.slice(-6, -3)), u = new C().fromArray(s.slice(-3)), d = r.distanceTo(u) < 1e-4, l = c.distanceTo(u) < 1e-4, h = new C(), f = d || l ? s.length / 3 - 1 : s.length / 3;
|
|
3910
3882
|
for (let p = 0; p < f; p++)
|
|
3911
3883
|
h.add(new C(s[p * 3], s[p * 3 + 1], s[p * 3 + 2]));
|
|
3912
3884
|
return h.divideScalar(f), h;
|
|
3913
|
-
}), e(
|
|
3885
|
+
}), e(dn, (s) => {
|
|
3914
3886
|
const r = [];
|
|
3915
|
-
for (let
|
|
3916
|
-
r.push(new C(s[
|
|
3887
|
+
for (let l = 0, h = s.length / 3; l < h; l++)
|
|
3888
|
+
r.push(new C(s[l * 3], s[l * 3 + 1], s[l * 3 + 2]));
|
|
3917
3889
|
const c = r[0].distanceTo(r[r.length - 1]) < 1e-4, u = r[r.length - 2].distanceTo(r[r.length - 1]) < 1e-4;
|
|
3918
|
-
if ((c || u) && r.pop(), r.length < 3)
|
|
3919
|
-
|
|
3920
|
-
let l = 0;
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
return l;
|
|
3890
|
+
if ((c || u) && r.pop(), r.length < 3) return 0;
|
|
3891
|
+
let d = 0;
|
|
3892
|
+
for (let l = 0, h = r.length - 2; l < h; l++)
|
|
3893
|
+
d += t(Gt, r[0], r[l + 1], r[l + 2], t(_).meterScale);
|
|
3894
|
+
return d;
|
|
3924
3895
|
}), e(rs, (s, r) => {
|
|
3925
3896
|
let c = 0;
|
|
3926
|
-
for (let u = 0,
|
|
3927
|
-
c += t(
|
|
3897
|
+
for (let u = 0, d = s.length - 2; u < d; u++)
|
|
3898
|
+
c += t(Gt, s[0], s[u + 1], s[u + 2], r);
|
|
3928
3899
|
return c;
|
|
3929
|
-
}), e(
|
|
3930
|
-
const
|
|
3931
|
-
return Math.sqrt(f * (f -
|
|
3900
|
+
}), e(Gt, (s, r, c, u) => {
|
|
3901
|
+
const d = s.distanceTo(r) * u, l = r.distanceTo(c) * u, h = c.distanceTo(s) * u, f = (d + l + h) / 2;
|
|
3902
|
+
return Math.sqrt(f * (f - d) * (f - l) * (f - h));
|
|
3932
3903
|
});
|
|
3933
3904
|
}
|
|
3934
3905
|
function Mr(i) {
|
|
3935
3906
|
const e = (h, ...f) => i.fire(h, ...f), t = (h, f, p) => i.on(h, f, p), n = [], a = [];
|
|
3936
3907
|
let o = !1, s = !1;
|
|
3937
|
-
t(
|
|
3908
|
+
t(zt, () => o = !1), t(xi, () => o = !0), t(bi, () => n), t(Oa, () => {
|
|
3938
3909
|
const h = [];
|
|
3939
3910
|
for (let f = 0, p = n.length; f < p; f++)
|
|
3940
3911
|
h.push(...n[f].toArray());
|
|
@@ -3944,16 +3915,16 @@ function Mr(i) {
|
|
|
3944
3915
|
for (let f = 0, p = a.length; f < p; f++)
|
|
3945
3916
|
h.push(...a[f].toArray());
|
|
3946
3917
|
return h;
|
|
3947
|
-
}), t(
|
|
3918
|
+
}), t(Yn, (h) => {
|
|
3948
3919
|
for (let f = 0, p = h.length / 3 | 0; f < p; f++)
|
|
3949
3920
|
n[f] = new C(h[f * 3 + 0], h[f * 3 + 1], h[f * 3 + 2]);
|
|
3950
|
-
}), t(
|
|
3921
|
+
}), t(Vn, (h) => {
|
|
3951
3922
|
for (let f = 0, p = h.length / 3 | 0; f < p; f++)
|
|
3952
3923
|
a[f] = new C(h[f * 3 + 0], h[f * 3 + 1], h[f * 3 + 2]);
|
|
3953
|
-
}), t(
|
|
3924
|
+
}), t(Hn, () => {
|
|
3954
3925
|
const h = e(Y);
|
|
3955
3926
|
n.push(h.object.position.clone()), a.push(h.target.clone());
|
|
3956
|
-
}), t(
|
|
3927
|
+
}), t(Wn, () => {
|
|
3957
3928
|
n.length = 0, a.length = 0;
|
|
3958
3929
|
}), t(Bs, async () => {
|
|
3959
3930
|
const h = e(ye).meta || {};
|
|
@@ -3966,30 +3937,32 @@ function Mr(i) {
|
|
|
3966
3937
|
delete h.flyPositions, delete h.flyTargets;
|
|
3967
3938
|
return await e(Pe, h);
|
|
3968
3939
|
}), t(Us, () => {
|
|
3969
|
-
s || (s = !0) && e(
|
|
3940
|
+
s || (s = !0) && e(Ot);
|
|
3970
3941
|
});
|
|
3971
3942
|
let r = 0;
|
|
3972
3943
|
const c = 120 * 1e3;
|
|
3973
|
-
let u = 0,
|
|
3974
|
-
t(
|
|
3975
|
-
if (r = 0, u = Date.now(),
|
|
3976
|
-
return;
|
|
3944
|
+
let u = 0, d, l;
|
|
3945
|
+
t(Ot, (h) => {
|
|
3946
|
+
if (r = 0, u = Date.now(), d = null, l = null, !n.length || !h && !e(Y).autoRotate) return;
|
|
3977
3947
|
const f = e(Y), p = [f.object.position.clone()], y = [f.target.clone()], g = e(bi) || [];
|
|
3978
3948
|
for (let m = 0, x = Math.min(g.length, 100); m < x; m++)
|
|
3979
3949
|
g[m] && p.push(g[m]), a[m] && y.push(a[m]);
|
|
3980
|
-
|
|
3981
|
-
}), t(
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3950
|
+
d = new ii(p), d.closed = !0, l = new ii(y), l.closed = !0, e(xi), e(q, !1);
|
|
3951
|
+
}), t(
|
|
3952
|
+
lt,
|
|
3953
|
+
() => {
|
|
3954
|
+
if (Date.now() - u > c && e(zt), !o || !d || !l) return;
|
|
3955
|
+
const h = e(Y);
|
|
3956
|
+
r = (Date.now() - u) / c;
|
|
3957
|
+
const f = d.getPoint(r), p = l.getPoint(r);
|
|
3958
|
+
h.object.position.set(f.x, f.y, f.z), h.target.set(p.x, p.y, p.z);
|
|
3959
|
+
},
|
|
3960
|
+
!0
|
|
3961
|
+
);
|
|
3989
3962
|
}
|
|
3990
3963
|
class Br {
|
|
3991
3964
|
constructor(e = {}) {
|
|
3992
|
-
this.disposed = !1, this.updateTime = 0, this.needUpdate = !0, console.info("Reall3dViewer",
|
|
3965
|
+
this.disposed = !1, this.updateTime = 0, this.needUpdate = !0, console.info("Reall3dViewer", Yt), this.init(Yi(e)), !e.disableDropLocalFile && this.enableDropLocalFile();
|
|
3993
3966
|
}
|
|
3994
3967
|
init(e) {
|
|
3995
3968
|
const t = this;
|
|
@@ -3998,40 +3971,40 @@ class Br {
|
|
|
3998
3971
|
No(e);
|
|
3999
3972
|
const o = e.controls = new dr(e);
|
|
4000
3973
|
o.updateByOptions(e);
|
|
4001
|
-
const s = new
|
|
3974
|
+
const s = new Nn();
|
|
4002
3975
|
e.viewerEvents = s, t.events = s;
|
|
4003
|
-
const r = (
|
|
4004
|
-
r(_, () => e), r(
|
|
3976
|
+
const r = (l, h, f) => s.on(l, h, f), c = (l, ...h) => s.fire(l, ...h);
|
|
3977
|
+
r(_, () => e), r(Ke, () => n.domElement), r(ct, () => n), r(B, () => a), r(Y, () => o), r(V, () => o.object), r(ee, () => e.bigSceneMode), r(Fa, (l) => e.pointcloudMode = l);
|
|
4005
3978
|
const u = [];
|
|
4006
3979
|
r(J, () => {
|
|
4007
3980
|
for (t.needUpdate = !0; u.length; ) u.pop().stop = !0;
|
|
4008
|
-
let
|
|
4009
|
-
u.push(
|
|
4010
|
-
|
|
3981
|
+
let l = { count: 0, stop: !1 };
|
|
3982
|
+
u.push(l), c(
|
|
3983
|
+
Pn,
|
|
4011
3984
|
() => {
|
|
4012
|
-
!t.disposed && (t.needUpdate = !0),
|
|
3985
|
+
!t.disposed && (t.needUpdate = !0), l.count++ >= 600 && (l.stop = !0);
|
|
4013
3986
|
},
|
|
4014
|
-
() => !t.disposed && (c(
|
|
3987
|
+
() => !t.disposed && (c(Un) || !l.stop),
|
|
4015
3988
|
10
|
|
4016
3989
|
);
|
|
4017
|
-
}),
|
|
3990
|
+
}), jn(s), Yo(s), qn(s), Sr(s), oa(s), vr(s), aa(s), xr(s), Mr(s), t.splatMesh = new pe(Xo(e)), r(ye, () => t.splatMesh), a.add(t.splatMesh), Zo(s), a.add(new as("#ffffff", 2)), a.add(c(_s)), n.setAnimationLoop(t.update.bind(t)), r(Si, () => {
|
|
4018
3991
|
o.update(), !t.needUpdate && c(ws) && c(J);
|
|
4019
|
-
}), r(Ve, () => c(
|
|
3992
|
+
}), r(Ve, () => c(Wt), !0), r(Ve, () => c(Si), !0), r(
|
|
4020
3993
|
Oe,
|
|
4021
3994
|
() => {
|
|
4022
3995
|
try {
|
|
4023
3996
|
!(t.needUpdate = !1) && n.render(a, c(V));
|
|
4024
|
-
} catch (
|
|
4025
|
-
console.warn(
|
|
3997
|
+
} catch (l) {
|
|
3998
|
+
console.warn(l.message);
|
|
4026
3999
|
}
|
|
4027
4000
|
},
|
|
4028
4001
|
!0
|
|
4029
4002
|
), r(lt, () => {
|
|
4030
|
-
}, !0), r(
|
|
4031
|
-
let
|
|
4032
|
-
r(
|
|
4033
|
-
|
|
4034
|
-
}), r(Ds, () =>
|
|
4003
|
+
}, !0), r(Ht, () => t.dispose()), r(Os, () => console.info(JSON.stringify(c(ye).meta || {}, null, 2)));
|
|
4004
|
+
let d = "";
|
|
4005
|
+
r(mt, (l = "") => {
|
|
4006
|
+
d = l, t.splatMesh.fire(Qn, d, !0);
|
|
4007
|
+
}), r(Ds, () => d), c(oe, { scale: `1 : ${c(_).meterScale} m` }), t.initGsApi();
|
|
4035
4008
|
}
|
|
4036
4009
|
/**
|
|
4037
4010
|
* 允许拖拽本地文件进行渲染
|
|
@@ -4073,8 +4046,8 @@ class Br {
|
|
|
4073
4046
|
// 开发调试用临时接口
|
|
4074
4047
|
fire(e, t, n) {
|
|
4075
4048
|
const a = this;
|
|
4076
|
-
e === 1 && a.splatMesh.fire(
|
|
4077
|
-
let o = await a.splatMesh.fire(
|
|
4049
|
+
e === 1 && a.splatMesh.fire(hn, t), e === 2 && a.events.fire(Hn), e === 3 && a.events.fire(Ot, !0), e === 4 && a.events.fire(Wn), e === 5 && a.events.fire(Bs), e === 6 && a.events.fire(kt), e === 7 && a.events.fire(Ls), e === 8 && (async () => {
|
|
4050
|
+
let o = await a.splatMesh.fire(Gn);
|
|
4078
4051
|
t && (o = a.splatMesh.fire(Ws) + t), a.splatMesh.fire(Fn, o);
|
|
4079
4052
|
})();
|
|
4080
4053
|
}
|
|
@@ -4088,7 +4061,7 @@ class Br {
|
|
|
4088
4061
|
if (t.disposed) return {};
|
|
4089
4062
|
const n = (r, ...c) => t.events.fire(r, ...c);
|
|
4090
4063
|
let a;
|
|
4091
|
-
return n(B).traverse((r) => !a && r instanceof pe && (a = r.options())), e && (e.autoRotate !== void 0 && (n(Y).autoRotate = e.autoRotate, n(_).autoRotate = e.autoRotate), e.pointcloudMode !== void 0 && n(
|
|
4064
|
+
return n(B).traverse((r) => !a && r instanceof pe && (a = r.options())), e && (e.autoRotate !== void 0 && (n(Y).autoRotate = e.autoRotate, n(_).autoRotate = e.autoRotate), e.pointcloudMode !== void 0 && n(Bt, e.pointcloudMode), e.lightFactor !== void 0 && n(rt, e.lightFactor), e.maxRenderCountOfMobile && (n(_).maxRenderCountOfMobile = e.maxRenderCountOfMobile), e.maxRenderCountOfPc && (n(_).maxRenderCountOfPc = e.maxRenderCountOfPc), e.debugMode !== void 0 && (n(_).debugMode = e.debugMode), e.markType !== void 0 && (n(_).markType = e.markType), e.markVisible !== void 0 && n(dt, e.markVisible), e.meterScale !== void 0 && (n(_).meterScale = e.meterScale), e.markMode !== void 0 && (n(_).markMode = e.markMode, !e.markMode && n(Bn), n(Y).autoRotate = n(_).autoRotate = !1)), n(Y).updateByOptions(e), n(oe, { scale: `1 : ${n(_).meterScale} m` }), Object.assign({ ...n(_) }, a);
|
|
4092
4065
|
}
|
|
4093
4066
|
/**
|
|
4094
4067
|
* 重置
|
|
@@ -4103,7 +4076,7 @@ class Br {
|
|
|
4103
4076
|
*/
|
|
4104
4077
|
switchDeiplayMode() {
|
|
4105
4078
|
const e = this;
|
|
4106
|
-
e.disposed || e.events.fire(
|
|
4079
|
+
e.disposed || e.events.fire(Ut);
|
|
4107
4080
|
}
|
|
4108
4081
|
/**
|
|
4109
4082
|
* 添加场景
|
|
@@ -4127,7 +4100,7 @@ class Br {
|
|
|
4127
4100
|
if (!a.url.endsWith(".bin") && !a.url.endsWith(".spx"))
|
|
4128
4101
|
return console.error("The format is unsupported in the large scene mode", a.url);
|
|
4129
4102
|
const o = { ...a, ...a.cameraInfo || {} };
|
|
4130
|
-
a.autoCut = Math.min(Math.max(a.autoCut || 0, 0), 50), o.bigSceneMode = a.autoCut > 1, t.reset({ ...o }), !o.bigSceneMode && delete a.autoCut, t.splatMesh.meta = a, le && (a.cameraInfo?.position || a.cameraInfo?.lookAt) && t.events.fire(Y)._dollyOut(0.75), o.bigSceneMode ? (n(
|
|
4103
|
+
a.autoCut = Math.min(Math.max(a.autoCut || 0, 0), 50), o.bigSceneMode = a.autoCut > 1, t.reset({ ...o }), !o.bigSceneMode && delete a.autoCut, t.splatMesh.meta = a, le && (a.cameraInfo?.position || a.cameraInfo?.lookAt) && t.events.fire(Y)._dollyOut(0.75), o.bigSceneMode ? (n(Yn, a.flyPositions || []), n(Vn, a.flyTargets || [])) : n(An, a), await t.splatMesh.addModel({ url: a.url }, a), await n(mt, a.watermark), n(Y).updateRotateAxis();
|
|
4131
4104
|
}
|
|
4132
4105
|
/**
|
|
4133
4106
|
* 添加要渲染的高斯模型(小场景模式)
|
|
@@ -4163,39 +4136,39 @@ class Br {
|
|
|
4163
4136
|
console.error("unknow format!", o.url);
|
|
4164
4137
|
return;
|
|
4165
4138
|
}
|
|
4166
|
-
n(
|
|
4139
|
+
n(An, r), await t.splatMesh.addModel(o, r), await n(mt, r.watermark);
|
|
4167
4140
|
}
|
|
4168
4141
|
/**
|
|
4169
4142
|
* 根据需要暴露的接口
|
|
4170
4143
|
*/
|
|
4171
4144
|
initGsApi() {
|
|
4172
|
-
const e = (
|
|
4173
|
-
setTimeout(() => window.focus()), e(
|
|
4174
|
-
}, n = (
|
|
4175
|
-
setTimeout(() => window.focus()),
|
|
4176
|
-
const
|
|
4177
|
-
|
|
4178
|
-
}, a = (
|
|
4179
|
-
setTimeout(() => window.focus()), e(dt, !!
|
|
4180
|
-
}, o = (
|
|
4145
|
+
const e = (d, ...l) => this.events.fire(d, ...l), t = () => {
|
|
4146
|
+
setTimeout(() => window.focus()), e(zt), e(Y).autoRotate = e(_).autoRotate = !e(_).autoRotate;
|
|
4147
|
+
}, n = (d = !0) => {
|
|
4148
|
+
setTimeout(() => window.focus()), d = !!d;
|
|
4149
|
+
const l = e(_);
|
|
4150
|
+
l.pointcloudMode !== d && (l.bigSceneMode ? e(Bt, d) : e(Ut));
|
|
4151
|
+
}, a = (d = !0) => {
|
|
4152
|
+
setTimeout(() => window.focus()), e(dt, !!d);
|
|
4153
|
+
}, o = (d) => {
|
|
4181
4154
|
setTimeout(() => window.focus());
|
|
4182
|
-
const
|
|
4183
|
-
if (
|
|
4184
|
-
if (
|
|
4185
|
-
|
|
4186
|
-
else if (
|
|
4187
|
-
|
|
4188
|
-
else if (
|
|
4189
|
-
|
|
4190
|
-
else if (
|
|
4191
|
-
|
|
4155
|
+
const l = e(_);
|
|
4156
|
+
if (l.markMode) return !1;
|
|
4157
|
+
if (d === 1)
|
|
4158
|
+
l.markType = "point";
|
|
4159
|
+
else if (d === 2)
|
|
4160
|
+
l.markType = "lines";
|
|
4161
|
+
else if (d === 3)
|
|
4162
|
+
l.markType = "plans";
|
|
4163
|
+
else if (d === 4)
|
|
4164
|
+
l.markType = "distance";
|
|
4192
4165
|
else
|
|
4193
4166
|
return !1;
|
|
4194
|
-
return
|
|
4195
|
-
}, s = async (
|
|
4196
|
-
setTimeout(() => window.focus()), e(
|
|
4197
|
-
}, u = (
|
|
4198
|
-
e(
|
|
4167
|
+
return l.markMode = !0, e(q), !0;
|
|
4168
|
+
}, s = async (d) => (setTimeout(() => window.focus()), d ? (e(st, d)?.dispose(), e(J), await e(kt)) : !1), r = async (d, l = !0) => (e(Ps, d, l), e(st, d?.name)?.drawUpdate?.(d, l), e(J), l ? (setTimeout(() => window.focus()), await e(kt)) : !0), c = (d = !0) => {
|
|
4169
|
+
setTimeout(() => window.focus()), e(hn, !!d);
|
|
4170
|
+
}, u = (d, l = !0) => {
|
|
4171
|
+
e(mt, d), l && e(Fs, d);
|
|
4199
4172
|
};
|
|
4200
4173
|
window.$api = { switchAutoRotate: t, changePointCloudMode: n, showMark: a, startMark: o, deleteMark: s, updateMark: r, showWaterMark: c, setWaterMark: u };
|
|
4201
4174
|
}
|
|
@@ -4207,28 +4180,28 @@ class Br {
|
|
|
4207
4180
|
if (e.disposed) return;
|
|
4208
4181
|
e.disposed = !0;
|
|
4209
4182
|
const t = (a, ...o) => e.events.fire(a, ...o);
|
|
4210
|
-
t(
|
|
4183
|
+
t(Rn), t(As), t(zn), t(Ln), t(Y).dispose(), t(ke, t(B));
|
|
4211
4184
|
const n = t(ct);
|
|
4212
4185
|
n.clear(), n.dispose(), e.splatMesh = null, e.events.clear(), e.events = null;
|
|
4213
4186
|
}
|
|
4214
4187
|
}
|
|
4215
4188
|
function Tr(i) {
|
|
4216
4189
|
const e = (s, r, c) => i.on(s, r, c), t = (s, ...r) => i.fire(s, ...r), n = le ? 1 : 20, a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
4217
|
-
e(
|
|
4190
|
+
e(It, () => t(re) && a.set(Date.now(), 1)), e(Dt, () => t(re) && t(Ye, a)), e(Pt, () => t(re) && o.set(Date.now(), 1)), e(Lt, () => t(re) && t(Ye, o)), e(Ye, (s) => {
|
|
4218
4191
|
let r = [], c = Date.now(), u = 0;
|
|
4219
|
-
for (const
|
|
4220
|
-
c -
|
|
4221
|
-
return r.forEach((
|
|
4192
|
+
for (const d of s.keys())
|
|
4193
|
+
c - d <= 1e3 ? u++ : r.push(d);
|
|
4194
|
+
return r.forEach((d) => s.delete(d)), Math.min(u, 30);
|
|
4222
4195
|
}), e(X, () => {
|
|
4223
4196
|
const s = t(B), r = t(V), c = [];
|
|
4224
4197
|
return s?.traverse(function(u) {
|
|
4225
4198
|
u.isWarpSplatMesh && u.splatMesh?.visible && c.push(u);
|
|
4226
|
-
}), c.sort((u,
|
|
4227
|
-
}), e(
|
|
4199
|
+
}), c.sort((u, d) => r.position.distanceTo(u.position) - r.position.distanceTo(d.position)), window.splat = c[0]?.splatMesh, c[0]?.splatMesh;
|
|
4200
|
+
}), e(Ks, () => {
|
|
4228
4201
|
const s = t(B), r = t(V), c = [];
|
|
4229
4202
|
s?.traverse(function(u) {
|
|
4230
4203
|
u.isWarpSplatMesh && c.push(u);
|
|
4231
|
-
}), c.sort((u,
|
|
4204
|
+
}), c.sort((u, d) => r.position.distanceTo(u.position) - r.position.distanceTo(d.position));
|
|
4232
4205
|
for (let u = 0; u < c.length; u++)
|
|
4233
4206
|
c[u].active = u < n, c[u].splatMesh && (c[u].splatMesh.renderOrder = 1e3 - u);
|
|
4234
4207
|
}), e(Zs, () => {
|
|
@@ -4236,19 +4209,19 @@ function Tr(i) {
|
|
|
4236
4209
|
s?.traverse((c) => r.push(c)), r.forEach((c) => {
|
|
4237
4210
|
c.dispose ? c.dispose() : (c.geometry?.dispose?.(), c.material && c.material instanceof Array ? c.material.forEach((u) => u?.dispose?.()) : c.material?.dispose?.());
|
|
4238
4211
|
}), s?.clear();
|
|
4239
|
-
}), e(
|
|
4212
|
+
}), e(wn, (s = 0.1) => {
|
|
4240
4213
|
const r = t(X);
|
|
4241
4214
|
r && r.visible && r.rotateOnAxis(new C(1, 0, 0), be.degToRad(s));
|
|
4242
4215
|
}), e(vn, (s = 0.1) => {
|
|
4243
4216
|
const r = t(X);
|
|
4244
4217
|
r && r.visible && r.rotateOnAxis(new C(0, 1, 0), be.degToRad(s));
|
|
4245
|
-
}), e(
|
|
4218
|
+
}), e(Sn, (s = 0.1) => {
|
|
4246
4219
|
const r = t(X);
|
|
4247
4220
|
r && r.visible && r.rotateOnAxis(new C(0, 0, 1), be.degToRad(s));
|
|
4248
4221
|
}), e(Ha, (s = 0.01) => {
|
|
4249
4222
|
const r = t(X);
|
|
4250
4223
|
r && r.visible && (r.position.x += s);
|
|
4251
|
-
}), e(
|
|
4224
|
+
}), e($s, (s = 0.01) => {
|
|
4252
4225
|
const r = t(X);
|
|
4253
4226
|
r && r.visible && (r.position.y += s);
|
|
4254
4227
|
}), e(Wa, (s = 0.01) => {
|
|
@@ -4264,34 +4237,37 @@ function Tr(i) {
|
|
|
4264
4237
|
const s = t(X);
|
|
4265
4238
|
s && (s.visible = !s.visible);
|
|
4266
4239
|
}), e(Na, async (s) => {
|
|
4267
|
-
if (!s && (s = t(X)), !s)
|
|
4268
|
-
return;
|
|
4240
|
+
if (!s && (s = t(X)), !s) return;
|
|
4269
4241
|
const r = s.meta || {};
|
|
4270
4242
|
return r.transform = s.matrix.toArray(), await t(Pe, JSON.stringify(r), s.meta.url);
|
|
4271
4243
|
}), e(Vs, () => {
|
|
4272
4244
|
const s = t(_).root, r = new es({ antialias: !1, logarithmicDepthBuffer: !0, stencil: !0, alpha: !0, precision: "highp" });
|
|
4273
|
-
return r.setSize(s.clientWidth, s.clientHeight), r.setPixelRatio(Math.min(devicePixelRatio, 2)), e(ct, () => r), e(
|
|
4245
|
+
return r.setSize(s.clientWidth, s.clientHeight), r.setPixelRatio(Math.min(devicePixelRatio, 2)), e(ct, () => r), e(Ke, () => r.domElement), r;
|
|
4274
4246
|
}), e(Gs, () => {
|
|
4275
4247
|
const s = new ss(), r = 14414079;
|
|
4276
|
-
return s.background = new is(r), s.fog = new
|
|
4248
|
+
return s.background = new is(r), s.fog = new si(r, 0), e(B, () => s), s;
|
|
4277
4249
|
}), e(Ns, () => {
|
|
4278
|
-
const r = t(V), c = t(B), u = t(_),
|
|
4279
|
-
return
|
|
4280
|
-
const
|
|
4281
|
-
|
|
4282
|
-
}), e(Y, () =>
|
|
4250
|
+
const r = t(V), c = t(B), u = t(_), d = new ur(t(V), u.root);
|
|
4251
|
+
return d.screenSpacePanning = !1, d.minDistance = 0.1, d.maxDistance = 1e5, d.maxPolarAngle = 1.2, d.enableDamping = !0, d.dampingFactor = 0.07, d.zoomToCursor = !0, d.addEventListener("change", () => {
|
|
4252
|
+
const l = Math.max(d.getPolarAngle(), 0.1), h = Math.max(d.getDistance(), 0.1);
|
|
4253
|
+
d.zoomSpeed = Math.max(Math.log(h), 0) + 0.5, r.far = be.clamp(h / l * 8, 100, 2e5), r.near = r.far / 1e3, r.updateProjectionMatrix(), c.fog instanceof si && (c.fog.density = l / (h + 5) * 1 * 0.25), d.maxPolarAngle = Math.min(Math.pow(1e4 / h, 4), 1.2);
|
|
4254
|
+
}), e(Y, () => d), e(ft, () => r.fov), e(Be, (l = !1) => l ? r.position.clone() : r.position), e(Ce, (l = !1) => l ? d.target.clone() : d.target), e(Ne, (l = !1) => l ? r.up.clone() : r.up), d;
|
|
4283
4255
|
}), e(Xs, () => {
|
|
4284
|
-
const s = new
|
|
4256
|
+
const s = new Sa(16777215, 1);
|
|
4285
4257
|
return s.position.set(0, 2e3, 1e3), s;
|
|
4286
|
-
}), window.addEventListener("beforeunload", () => t(
|
|
4258
|
+
}), window.addEventListener("beforeunload", () => t(Ht));
|
|
4287
4259
|
}
|
|
4288
4260
|
function kr(i) {
|
|
4289
4261
|
let { root: e = "#map", debugMode: t } = i;
|
|
4290
|
-
return e ? e = typeof e == "string" ? document.querySelector(e) || document.querySelector("#map") : e : e = document.querySelector("#map"), e || (e = document.createElement("div"), e.id = "map", document.querySelector("#gsviewer").appendChild(e)), { root: e, debugMode: t };
|
|
4262
|
+
return e ? e = typeof e == "string" ? document.querySelector(e) || document.querySelector("#map") : e : e = document.querySelector("#map"), e || (e = document.createElement("div"), e.id = "map", (document.querySelector("#gsviewer") || document.querySelector("body")).appendChild(e)), { root: e, debugMode: t };
|
|
4291
4263
|
}
|
|
4292
4264
|
function Er() {
|
|
4293
|
-
const i =
|
|
4294
|
-
|
|
4265
|
+
const i = ai.TileSource.create({
|
|
4266
|
+
dataType: "image",
|
|
4267
|
+
attribution: "ArcGIS",
|
|
4268
|
+
url: "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
|
|
4269
|
+
}), e = new ai.TileMap({ imgSource: i, lon0: 90, minLevel: 2, maxLevel: 16 });
|
|
4270
|
+
return e.scale.set(10, 10, 10), e.rotateX(-Math.PI / 2), e.autoUpdate = !1, e;
|
|
4295
4271
|
}
|
|
4296
4272
|
class _r {
|
|
4297
4273
|
constructor() {
|
|
@@ -4299,17 +4275,16 @@ class _r {
|
|
|
4299
4275
|
}
|
|
4300
4276
|
}
|
|
4301
4277
|
function Ir(i) {
|
|
4302
|
-
const e = (w, I,
|
|
4278
|
+
const e = (w, I, S) => i.on(w, I, S), t = (w, ...I) => i.fire(w, ...I), n = t(Ke);
|
|
4303
4279
|
let a = /* @__PURE__ */ new Set(), o, s = new _r();
|
|
4304
|
-
e(
|
|
4280
|
+
e(Wt, () => {
|
|
4305
4281
|
if (a.size)
|
|
4306
4282
|
if (a.has("KeyH")) {
|
|
4307
4283
|
const w = t(X);
|
|
4308
4284
|
w && (w.visible = !w.visible), a.clear();
|
|
4309
4285
|
} else if (a.has("Equal")) {
|
|
4310
4286
|
const w = t(X);
|
|
4311
|
-
if (!w || !w.visible)
|
|
4312
|
-
return a.clear();
|
|
4287
|
+
if (!w || !w.visible) return a.clear();
|
|
4313
4288
|
if (a.has("KeyX")) {
|
|
4314
4289
|
const I = be.degToRad(0.1);
|
|
4315
4290
|
w.rotateOnAxis(new C(1, 0, 0), I);
|
|
@@ -4317,8 +4292,7 @@ function Ir(i) {
|
|
|
4317
4292
|
w.scale.set(w.scale.x + 0.01, w.scale.y + 0.01, w.scale.z + 0.01);
|
|
4318
4293
|
} else if (a.has("Minus")) {
|
|
4319
4294
|
const w = t(X);
|
|
4320
|
-
if (!w || !w.visible)
|
|
4321
|
-
return a.clear();
|
|
4295
|
+
if (!w || !w.visible) return a.clear();
|
|
4322
4296
|
if (a.has("KeyX")) {
|
|
4323
4297
|
const I = be.degToRad(-0.1);
|
|
4324
4298
|
w.rotateOnAxis(new C(1, 0, 0), I);
|
|
@@ -4342,7 +4316,7 @@ function Ir(i) {
|
|
|
4342
4316
|
const I = w.meta || {};
|
|
4343
4317
|
I.transform = w.matrix.toArray();
|
|
4344
4318
|
}
|
|
4345
|
-
} else a.has("KeyQ") ? t(
|
|
4319
|
+
} else a.has("KeyQ") ? t(wn, 0.1) : a.has("KeyW") ? t(vn, 0.1) : a.has("KeyE") ? t(Sn, 0.1) : a.has("KeyA") ? t(wn, -0.1) : a.has("KeyS") ? t(vn, -0.1) : a.has("KeyD") ? t(Sn, -0.1) : a.has("KeyY") ? t($s, a.has("ShiftLeft") || a.has("ShiftRight") ? -0.1 : 0.1) : a.has("KeyC") && console.info("position=", t(Be).toArray(), "lookat=", t(Ce).toArray());
|
|
4346
4320
|
});
|
|
4347
4321
|
const r = (w) => {
|
|
4348
4322
|
console.info(w.code), w.target.type !== "text" && (o || w.code === "F5" || (w.preventDefault(), a.add(w.code)));
|
|
@@ -4350,9 +4324,9 @@ function Ir(i) {
|
|
|
4350
4324
|
w.target.type !== "text" && (o || a.clear());
|
|
4351
4325
|
}, u = () => {
|
|
4352
4326
|
a.clear();
|
|
4353
|
-
},
|
|
4327
|
+
}, d = (w) => {
|
|
4354
4328
|
parent && setTimeout(() => window.focus()), w.preventDefault();
|
|
4355
|
-
},
|
|
4329
|
+
}, l = async (w) => {
|
|
4356
4330
|
w.preventDefault();
|
|
4357
4331
|
};
|
|
4358
4332
|
let h, f, p, y;
|
|
@@ -4369,14 +4343,14 @@ function Ir(i) {
|
|
|
4369
4343
|
function b(w) {
|
|
4370
4344
|
w.preventDefault(), !o && (s.down = w.touches.length, s.down === 1 && (s.move = !1, s.x = w.touches[0].clientX, s.y = w.touches[0].clientY));
|
|
4371
4345
|
}
|
|
4372
|
-
function
|
|
4346
|
+
function v(w) {
|
|
4373
4347
|
w.touches.length === 1 && (s.move = !0);
|
|
4374
4348
|
}
|
|
4375
4349
|
function T(w) {
|
|
4376
4350
|
s.down === 1 && !s.move && t(it, s.x, s.y);
|
|
4377
4351
|
}
|
|
4378
|
-
window.addEventListener("keydown", r), window.addEventListener("keyup", c), window.addEventListener("blur", u), window.addEventListener("wheel",
|
|
4379
|
-
o = !0, window.removeEventListener("keydown", r), window.removeEventListener("keyup", c), window.removeEventListener("blur", u), window.removeEventListener("wheel",
|
|
4352
|
+
window.addEventListener("keydown", r), window.addEventListener("keyup", c), window.addEventListener("blur", u), window.addEventListener("wheel", d, { passive: !1 }), n.addEventListener("contextmenu", l), n.addEventListener("mousedown", g), n.addEventListener("mousemove", m), n.addEventListener("mouseup", x), n.addEventListener("touchstart", b, { passive: !1 }), n.addEventListener("touchmove", v, { passive: !1 }), n.addEventListener("touchend", T, { passive: !1 }), e(Ln, () => {
|
|
4353
|
+
o = !0, window.removeEventListener("keydown", r), window.removeEventListener("keyup", c), window.removeEventListener("blur", u), window.removeEventListener("wheel", d), n.removeEventListener("contextmenu", l), n.removeEventListener("mousedown", g), n.removeEventListener("mousemove", m), n.removeEventListener("mouseup", x), n.removeEventListener("touchstart", b), n.removeEventListener("touchmove", v), n.removeEventListener("touchend", T);
|
|
4380
4354
|
}), e(it, async (w, I) => await t(Ft, w, I));
|
|
4381
4355
|
}
|
|
4382
4356
|
var Ge = Object.freeze({
|
|
@@ -4569,9 +4543,9 @@ var Ge = Object.freeze({
|
|
|
4569
4543
|
}
|
|
4570
4544
|
}, i;
|
|
4571
4545
|
}()
|
|
4572
|
-
),
|
|
4546
|
+
), kn = {
|
|
4573
4547
|
Linear: function(i, e) {
|
|
4574
|
-
var t = i.length - 1, n = t * e, a = Math.floor(n), o =
|
|
4548
|
+
var t = i.length - 1, n = t * e, a = Math.floor(n), o = kn.Utils.Linear;
|
|
4575
4549
|
return e < 0 ? o(i[0], i[1], n) : e > 1 ? o(i[t], i[t - 1], t - n) : o(i[a], i[a + 1 > t ? t : a + 1], n - a);
|
|
4576
4550
|
},
|
|
4577
4551
|
Utils: {
|
|
@@ -4588,11 +4562,11 @@ var Ge = Object.freeze({
|
|
|
4588
4562
|
return i._nextId++;
|
|
4589
4563
|
}, i._nextId = 0, i;
|
|
4590
4564
|
}()
|
|
4591
|
-
),
|
|
4565
|
+
), En = new Dr(), Pr = (
|
|
4592
4566
|
/** @class */
|
|
4593
4567
|
function() {
|
|
4594
4568
|
function i(e, t) {
|
|
4595
|
-
this._isPaused = !1, this._pauseStart = 0, this._valuesStart = {}, this._valuesEnd = {}, this._valuesStartRepeat = {}, this._duration = 1e3, this._isDynamic = !1, this._initialRepeat = 0, this._repeat = 0, this._yoyo = !1, this._isPlaying = !1, this._reversed = !1, this._delayTime = 0, this._startTime = 0, this._easingFunction = Ge.Linear.None, this._interpolationFunction =
|
|
4569
|
+
this._isPaused = !1, this._pauseStart = 0, this._valuesStart = {}, this._valuesEnd = {}, this._valuesStartRepeat = {}, this._duration = 1e3, this._isDynamic = !1, this._initialRepeat = 0, this._repeat = 0, this._yoyo = !1, this._isPlaying = !1, this._reversed = !1, this._delayTime = 0, this._startTime = 0, this._easingFunction = Ge.Linear.None, this._interpolationFunction = kn.Linear, this._chainedTweens = [], this._onStartCallbackFired = !1, this._onEveryStartCallbackFired = !1, this._id = ra.nextId(), this._isChainStopped = !1, this._propertiesAreSetUp = !1, this._goToEnd = !1, this._object = e, typeof t == "object" ? (this._group = t, t.add(this)) : t === !0 && (this._group = En, En.add(this));
|
|
4596
4570
|
}
|
|
4597
4571
|
return i.prototype.getId = function() {
|
|
4598
4572
|
return this._id;
|
|
@@ -4632,38 +4606,38 @@ var Ge = Object.freeze({
|
|
|
4632
4606
|
return this.start(e, !0);
|
|
4633
4607
|
}, i.prototype._setupProperties = function(e, t, n, a, o) {
|
|
4634
4608
|
for (var s in n) {
|
|
4635
|
-
var r = e[s], c = Array.isArray(r), u = c ? "array" : typeof r,
|
|
4609
|
+
var r = e[s], c = Array.isArray(r), u = c ? "array" : typeof r, d = !c && Array.isArray(n[s]);
|
|
4636
4610
|
if (!(u === "undefined" || u === "function")) {
|
|
4637
|
-
if (
|
|
4638
|
-
var
|
|
4639
|
-
if (
|
|
4611
|
+
if (d) {
|
|
4612
|
+
var l = n[s];
|
|
4613
|
+
if (l.length === 0)
|
|
4640
4614
|
continue;
|
|
4641
|
-
for (var h = [r], f = 0, p =
|
|
4642
|
-
var y = this._handleRelativeValue(r,
|
|
4615
|
+
for (var h = [r], f = 0, p = l.length; f < p; f += 1) {
|
|
4616
|
+
var y = this._handleRelativeValue(r, l[f]);
|
|
4643
4617
|
if (isNaN(y)) {
|
|
4644
|
-
|
|
4618
|
+
d = !1, console.warn("Found invalid interpolation list. Skipping.");
|
|
4645
4619
|
break;
|
|
4646
4620
|
}
|
|
4647
4621
|
h.push(y);
|
|
4648
4622
|
}
|
|
4649
|
-
|
|
4623
|
+
d && (n[s] = h);
|
|
4650
4624
|
}
|
|
4651
|
-
if ((u === "object" || c) && r && !
|
|
4625
|
+
if ((u === "object" || c) && r && !d) {
|
|
4652
4626
|
t[s] = c ? [] : {};
|
|
4653
4627
|
var g = r;
|
|
4654
4628
|
for (var m in g)
|
|
4655
4629
|
t[s][m] = g[m];
|
|
4656
4630
|
a[s] = c ? [] : {};
|
|
4657
|
-
var
|
|
4631
|
+
var l = n[s];
|
|
4658
4632
|
if (!this._isDynamic) {
|
|
4659
4633
|
var x = {};
|
|
4660
|
-
for (var m in
|
|
4661
|
-
x[m] =
|
|
4662
|
-
n[s] =
|
|
4634
|
+
for (var m in l)
|
|
4635
|
+
x[m] = l[m];
|
|
4636
|
+
n[s] = l = x;
|
|
4663
4637
|
}
|
|
4664
|
-
this._setupProperties(g, t[s],
|
|
4638
|
+
this._setupProperties(g, t[s], l, a[s], o);
|
|
4665
4639
|
} else
|
|
4666
|
-
(typeof t[s] > "u" || o) && (t[s] = r), c || (t[s] *= 1),
|
|
4640
|
+
(typeof t[s] > "u" || o) && (t[s] = r), c || (t[s] *= 1), d ? a[s] = n[s].slice().reverse() : a[s] = t[s] || 0;
|
|
4667
4641
|
}
|
|
4668
4642
|
}
|
|
4669
4643
|
}, i.prototype.stop = function() {
|
|
@@ -4694,7 +4668,7 @@ var Ge = Object.freeze({
|
|
|
4694
4668
|
}, i.prototype.easing = function(e) {
|
|
4695
4669
|
return e === void 0 && (e = Ge.Linear.None), this._easingFunction = e, this;
|
|
4696
4670
|
}, i.prototype.interpolation = function(e) {
|
|
4697
|
-
return e === void 0 && (e =
|
|
4671
|
+
return e === void 0 && (e = kn.Linear), this._interpolationFunction = e, this;
|
|
4698
4672
|
}, i.prototype.chain = function() {
|
|
4699
4673
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
4700
4674
|
e[t] = arguments[t];
|
|
@@ -4729,8 +4703,8 @@ var Ge = Object.freeze({
|
|
|
4729
4703
|
return 1;
|
|
4730
4704
|
var y = Math.trunc(s / r), g = s - y * r, m = Math.min(g / n._duration, 1);
|
|
4731
4705
|
return m === 0 && s === n._duration ? 1 : m;
|
|
4732
|
-
},
|
|
4733
|
-
if (this._updateProperties(this._object, this._valuesStart, this._valuesEnd,
|
|
4706
|
+
}, d = u(), l = this._easingFunction(d);
|
|
4707
|
+
if (this._updateProperties(this._object, this._valuesStart, this._valuesEnd, l), this._onUpdateCallback && this._onUpdateCallback(this._object, d), this._duration === 0 || s >= this._duration)
|
|
4734
4708
|
if (this._repeat > 0) {
|
|
4735
4709
|
var h = Math.min(Math.trunc((s - this._duration) / r) + 1, this._repeat);
|
|
4736
4710
|
isFinite(this._repeat) && (this._repeat -= h);
|
|
@@ -4749,8 +4723,8 @@ var Ge = Object.freeze({
|
|
|
4749
4723
|
}, i.prototype._updateProperties = function(e, t, n, a) {
|
|
4750
4724
|
for (var o in n)
|
|
4751
4725
|
if (t[o] !== void 0) {
|
|
4752
|
-
var s = t[o] || 0, r = n[o], c = Array.isArray(e[o]), u = Array.isArray(r),
|
|
4753
|
-
|
|
4726
|
+
var s = t[o] || 0, r = n[o], c = Array.isArray(e[o]), u = Array.isArray(r), d = !c && u;
|
|
4727
|
+
d ? e[o] = this._interpolationFunction(r, a) : typeof r == "object" && r ? this._updateProperties(e[o], s, r, a) : (r = this._handleRelativeValue(s, r), typeof r == "number" && (e[o] = s + (r - s) * a));
|
|
4754
4728
|
}
|
|
4755
4729
|
}, i.prototype._handleRelativeValue = function(e, t) {
|
|
4756
4730
|
return typeof t != "string" ? t : t.charAt(0) === "+" || t.charAt(0) === "-" ? e + parseFloat(t) : parseFloat(t);
|
|
@@ -4761,7 +4735,7 @@ var Ge = Object.freeze({
|
|
|
4761
4735
|
}()
|
|
4762
4736
|
);
|
|
4763
4737
|
ra.nextId;
|
|
4764
|
-
var me =
|
|
4738
|
+
var me = En;
|
|
4765
4739
|
me.getAll.bind(me);
|
|
4766
4740
|
me.removeAll.bind(me);
|
|
4767
4741
|
me.add.bind(me);
|
|
@@ -4775,7 +4749,7 @@ class Lr extends te {
|
|
|
4775
4749
|
async addScene(e) {
|
|
4776
4750
|
const t = this, { renderer: n, scene: a, controls: o, tileMap: s } = t.mapViewer;
|
|
4777
4751
|
fetch(e, { mode: "cors", credentials: "omit", cache: "reload" }).then((r) => r.ok ? r.json() : {}).then((r) => {
|
|
4778
|
-
const c = new
|
|
4752
|
+
const c = new $e();
|
|
4779
4753
|
if (r.transform)
|
|
4780
4754
|
c.fromArray(r.transform);
|
|
4781
4755
|
else if (r.WGS84) {
|
|
@@ -4783,7 +4757,7 @@ class Lr extends te {
|
|
|
4783
4757
|
c.makeTranslation(p.x, p.y, p.z);
|
|
4784
4758
|
}
|
|
4785
4759
|
r.autoCut && (r.autoCut = Math.min(Math.max(r.autoCut, 1), 50));
|
|
4786
|
-
const u = r.autoCut && r.autoCut > 1,
|
|
4760
|
+
const u = r.autoCut && r.autoCut > 1, d = !1, l = !1, h = r.showWatermark !== !1, f = { renderer: n, scene: a, controls: o, pointcloudMode: d, bigSceneMode: u, matrix: c, showWatermark: h, depthTest: l };
|
|
4787
4761
|
f.maxRenderCountOfMobile ?? (f.maxRenderCountOfMobile = f.bigSceneMode ? 128 * 10240 : 400 * 1e4), f.maxRenderCountOfPc ?? (f.maxRenderCountOfPc = f.bigSceneMode ? 320 * 1e4 : 400 * 1e4), f.debugMode = this.mapViewer.events.fire(_).debugMode, t.opts = f, t.meta = r, a.add(t), t.initCSS3DSprite(f), t.applyMatrix4(c);
|
|
4788
4762
|
}).catch((r) => {
|
|
4789
4763
|
console.error(r.message);
|
|
@@ -4796,9 +4770,8 @@ class Lr extends te {
|
|
|
4796
4770
|
</div>`, n.classList.add("splatmesh-point"), n.style.position = "absolute", n.style.borderRadius = "4px", n.style.cursor = "pointer";
|
|
4797
4771
|
let a = null;
|
|
4798
4772
|
n.onclick = () => {
|
|
4799
|
-
if (a)
|
|
4800
|
-
|
|
4801
|
-
const s = t.position, r = e.controls, c = r.object.position.clone(), u = Ji ? 6 : 2, l = s.clone().sub(c).normalize(), d = s.clone().sub(l.multiplyScalar(u)), h = { x: c.x, y: c.y, z: c.z, tx: r.target.x, ty: r.target.y, tz: r.target.z }, f = { x: d.x, y: d.y, z: d.z, tx: s.x, ty: s.y, tz: s.z };
|
|
4773
|
+
if (a) return;
|
|
4774
|
+
const s = t.position, r = e.controls, c = r.object.position.clone(), u = Ji ? 6 : 2, d = s.clone().sub(c).normalize(), l = s.clone().sub(d.multiplyScalar(u)), h = { x: c.x, y: c.y, z: c.z, tx: r.target.x, ty: r.target.y, tz: r.target.z }, f = { x: l.x, y: l.y, z: l.z, tx: s.x, ty: s.y, tz: s.z };
|
|
4802
4775
|
a = new Pr(h).to(f, 3e3), a.easing(Ge.Sinusoidal.InOut).start().onUpdate(() => {
|
|
4803
4776
|
const p = h.y < 0.1 ? 0.1 : h.y;
|
|
4804
4777
|
r.object.position.set(h.x, p, h.z), r.target.set(h.tx, h.ty, h.tz);
|
|
@@ -4826,10 +4799,10 @@ class Lr extends te {
|
|
|
4826
4799
|
else {
|
|
4827
4800
|
const c = t.meta, u = { ...t.opts };
|
|
4828
4801
|
c.autoCut && (u.bigSceneMode = !0);
|
|
4829
|
-
const
|
|
4830
|
-
t.splatMesh =
|
|
4831
|
-
const
|
|
4832
|
-
c.showWatermark = c.showWatermark !== !1,
|
|
4802
|
+
const d = new pe(u);
|
|
4803
|
+
t.splatMesh = d, t.opts.scene.add(d), d.applyMatrix4(t.opts.matrix), d.meta = c;
|
|
4804
|
+
const l = c.watermark || c.name || "";
|
|
4805
|
+
c.showWatermark = c.showWatermark !== !1, d.fire(Qn, l, !0, !1), d.addModel({ url: t.meta.url }, t.meta);
|
|
4833
4806
|
}
|
|
4834
4807
|
}
|
|
4835
4808
|
}, t.onAfterRender = () => {
|
|
@@ -4848,31 +4821,43 @@ class Lr extends te {
|
|
|
4848
4821
|
}
|
|
4849
4822
|
class Ur extends ba {
|
|
4850
4823
|
constructor(e = {}) {
|
|
4851
|
-
console.info("Reall3dMapViewer",
|
|
4852
|
-
const t = this, n = new
|
|
4824
|
+
console.info("Reall3dMapViewer", Yt), super(), this.clock = new xa(), this.updateTime = 0, this.disposed = !1;
|
|
4825
|
+
const t = this, n = new Nn();
|
|
4853
4826
|
t.events = n;
|
|
4854
4827
|
const a = (r, c, u) => n.on(r, c, u), o = (r, ...c) => n.fire(r, ...c);
|
|
4855
4828
|
t.tileMap = Er();
|
|
4856
4829
|
const s = kr(e);
|
|
4857
|
-
a(_, () => s),
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
}
|
|
4875
|
-
|
|
4830
|
+
a(_, () => s), jn(n), qn(n), Tr(n), aa(n), t.camera = new ts(60, 1, 0.01, 1e4), a(V, () => t.camera), t.container = s.root, t.renderer = o(Vs), t.scene = o(Gs), t.controls = o(Ns), t.ambLight = new as(16777215, 1), t.scene.add(t.ambLight), t.dirLight = o(Xs), t.scene.add(t.dirLight), t.scene.add(t.tileMap), t.container.appendChild(t.renderer.domElement), oa(n), Ir(n), window.addEventListener("resize", t.resize.bind(t)), t.resize(), t.renderer.setAnimationLoop(t.animate.bind(t)), a(Ht, () => t.dispose()), a(
|
|
4831
|
+
Ve,
|
|
4832
|
+
() => {
|
|
4833
|
+
o(Pt), t.controls.update(), o(Ks), o(Wt);
|
|
4834
|
+
},
|
|
4835
|
+
!0
|
|
4836
|
+
), a(
|
|
4837
|
+
lt,
|
|
4838
|
+
() => {
|
|
4839
|
+
t.dispatchEvent({ type: "update", delta: t.clock.getDelta() }), t.updateTime = Date.now(), o(re) && o(oe, {
|
|
4840
|
+
fps: o(Dt),
|
|
4841
|
+
realFps: o(Lt),
|
|
4842
|
+
fov: o(ft),
|
|
4843
|
+
position: o(Le, o(Be)),
|
|
4844
|
+
lookAt: o(Le, o(Ce)),
|
|
4845
|
+
lookUp: o(Le, o(Ne))
|
|
4846
|
+
});
|
|
4847
|
+
},
|
|
4848
|
+
!0
|
|
4849
|
+
), a(
|
|
4850
|
+
Oe,
|
|
4851
|
+
() => {
|
|
4852
|
+
t.tileMap.update(t.camera);
|
|
4853
|
+
try {
|
|
4854
|
+
t.renderer.render(t.scene, t.camera);
|
|
4855
|
+
} catch (r) {
|
|
4856
|
+
console.warn(r.message);
|
|
4857
|
+
}
|
|
4858
|
+
},
|
|
4859
|
+
!0
|
|
4860
|
+
);
|
|
4876
4861
|
}
|
|
4877
4862
|
/**
|
|
4878
4863
|
* 打开地图场景
|
|
@@ -4892,25 +4877,25 @@ class Ur extends ba {
|
|
|
4892
4877
|
}
|
|
4893
4878
|
resize() {
|
|
4894
4879
|
const e = this;
|
|
4895
|
-
if (e.disposed)
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4880
|
+
if (e.disposed) return;
|
|
4881
|
+
const { width: t, height: n, top: a, left: o } = e.container.getBoundingClientRect();
|
|
4882
|
+
e.renderer.setPixelRatio(Math.min(devicePixelRatio, 2)), e.renderer.setSize(t, n), e.camera.aspect = t / n, e.camera.updateProjectionMatrix();
|
|
4883
|
+
const s = e.events.fire(On);
|
|
4884
|
+
s.setSize(t, n), s.domElement.style.position = "absolute", s.domElement.style.left = `${o}px`, s.domElement.style.top = `${a}px`;
|
|
4899
4885
|
}
|
|
4900
4886
|
animate() {
|
|
4901
4887
|
const e = this, t = (n, ...a) => e.events.fire(n, ...a);
|
|
4902
|
-
t(
|
|
4888
|
+
t(It), Date.now() - e.updateTime > 30 && (t(Ve), t(Oe), t(lt));
|
|
4903
4889
|
}
|
|
4904
4890
|
/**
|
|
4905
4891
|
* 销毁
|
|
4906
4892
|
*/
|
|
4907
4893
|
dispose() {
|
|
4908
4894
|
const e = this;
|
|
4909
|
-
if (e.disposed)
|
|
4910
|
-
return;
|
|
4895
|
+
if (e.disposed) return;
|
|
4911
4896
|
e.disposed = !0;
|
|
4912
4897
|
const t = e.renderer.domElement;
|
|
4913
|
-
e.events.fire(
|
|
4898
|
+
e.events.fire(zn), e.events.fire(Zs), e.renderer.clear(), e.renderer.dispose(), e.events.clear(), e.scene = null, e.renderer = null, e.camera = null, e.controls = null, e.ambLight = null, e.dirLight = null, e.container.removeChild(t), e.container.classList.add("hidden"), e.container = null, e.clock = null, e.events = null, e.tileMap = null;
|
|
4914
4899
|
}
|
|
4915
4900
|
}
|
|
4916
4901
|
export {
|