@takram/three-geospatial 0.0.1-alpha.6 → 0.0.1-alpha.7
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/build/index.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.js +295 -236
- package/build/index.js.map +1 -1
- package/build/r3f.js +2 -2
- package/build/shaders.cjs +144 -23
- package/build/shaders.cjs.map +1 -1
- package/build/shaders.js +153 -31
- package/build/shaders.js.map +1 -1
- package/package.json +1 -1
- package/src/STBNLoader.ts +21 -0
- package/src/constants.ts +3 -0
- package/src/defineShorthand.ts +68 -0
- package/src/index.ts +2 -0
- package/src/math.ts +36 -1
- package/src/r3f/types.ts +11 -12
- package/src/shaders/cascadedShadowMaps.glsl +79 -0
- package/src/shaders/index.ts +2 -0
- package/src/shaders/math.glsl +56 -16
- package/src/shaders/poissonDisk.glsl +2 -0
- package/src/typedArrayParsers.ts +19 -8
- package/types/STBNLoader.d.ts +1 -0
- package/types/constants.d.ts +1 -0
- package/types/defineShorthand.d.ts +16 -0
- package/types/index.d.ts +2 -0
- package/types/math.d.ts +4 -1
- package/types/r3f/types.d.ts +5 -6
- package/types/shaders/index.d.ts +1 -0
package/build/index.js
CHANGED
@@ -1,216 +1,259 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var
|
4
|
-
import { Loader as
|
5
|
-
import { E as
|
6
|
-
import { a as
|
7
|
-
var
|
8
|
-
function
|
9
|
-
if (!
|
10
|
-
if (
|
11
|
-
throw new Error(
|
12
|
-
var e =
|
1
|
+
var J = Object.defineProperty;
|
2
|
+
var Z = (n, t, e) => t in n ? J(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
3
|
+
var d = (n, t, e) => Z(n, typeof t != "symbol" ? t + "" : t, e);
|
4
|
+
import { Loader as P, FileLoader as K, BufferGeometry as tt, BufferAttribute as B, Box3 as et, Vector3 as p, Sphere as nt, UnsignedByteType as st, ByteType as rt, FloatType as it, LinearFilter as N, ClampToEdgeWrapping as O, RGBAFormat as ot, Data3DTexture as at, DataTexture as ht, MathUtils as l, Quaternion as ct, Matrix4 as lt, Ray as dt, RepeatWrapping as D, NearestFilter as R, RedFormat as ut, Vector2 as H } from "three";
|
5
|
+
import { E as C, G as w } from "./shared.js";
|
6
|
+
import { a as xe } from "./shared.js";
|
7
|
+
var pt = process.env.NODE_ENV === "production", G = "Invariant failed";
|
8
|
+
function W(n, t) {
|
9
|
+
if (!n) {
|
10
|
+
if (pt)
|
11
|
+
throw new Error(G);
|
12
|
+
var e = G;
|
13
13
|
throw new Error(e);
|
14
14
|
}
|
15
15
|
}
|
16
|
-
class
|
17
|
-
load(t, e,
|
18
|
-
const
|
19
|
-
|
16
|
+
class ft extends P {
|
17
|
+
load(t, e, s, r) {
|
18
|
+
const i = new K(this.manager);
|
19
|
+
i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setPath(this.path), i.setWithCredentials(this.withCredentials), i.load(
|
20
20
|
t,
|
21
21
|
(o) => {
|
22
|
-
|
22
|
+
W(o instanceof ArrayBuffer);
|
23
23
|
try {
|
24
24
|
e(o);
|
25
25
|
} catch (a) {
|
26
|
-
|
26
|
+
r != null ? r(a) : console.error(a), this.manager.itemError(t);
|
27
27
|
}
|
28
28
|
},
|
29
|
-
|
30
|
-
|
29
|
+
s,
|
30
|
+
r
|
31
31
|
);
|
32
32
|
}
|
33
33
|
}
|
34
|
-
function
|
34
|
+
function Bt(n) {
|
35
35
|
}
|
36
|
-
function
|
37
|
-
var
|
38
|
-
const { attributes: t, index: e, boundingBox:
|
36
|
+
function Nt(n) {
|
37
|
+
var i;
|
38
|
+
const { attributes: t, index: e, boundingBox: s, boundingSphere: r } = n;
|
39
39
|
return [
|
40
|
-
{ attributes: t, index: e, boundingBox:
|
40
|
+
{ attributes: t, index: e, boundingBox: s, boundingSphere: r },
|
41
41
|
[
|
42
|
-
...Object.values(
|
42
|
+
...Object.values(n.attributes).map(
|
43
43
|
(o) => o.array.buffer
|
44
44
|
),
|
45
|
-
(
|
45
|
+
(i = n.index) == null ? void 0 : i.array.buffer
|
46
46
|
].filter((o) => o != null)
|
47
47
|
];
|
48
48
|
}
|
49
|
-
function
|
50
|
-
for (const [e,
|
49
|
+
function Ot(n, t = new tt()) {
|
50
|
+
for (const [e, s] of Object.entries(n.attributes))
|
51
51
|
t.setAttribute(
|
52
52
|
e,
|
53
|
-
new
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
new B(
|
54
|
+
s.array,
|
55
|
+
s.itemSize,
|
56
|
+
s.normalized
|
57
57
|
)
|
58
58
|
);
|
59
|
-
if (t.index =
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
) : null,
|
64
|
-
const { min: e, max:
|
65
|
-
t.boundingBox = new
|
59
|
+
if (t.index = n.index != null ? new B(
|
60
|
+
n.index.array,
|
61
|
+
n.index.itemSize,
|
62
|
+
n.index.normalized
|
63
|
+
) : null, n.boundingBox != null) {
|
64
|
+
const { min: e, max: s } = n.boundingBox;
|
65
|
+
t.boundingBox = new et(
|
66
66
|
new p(e.x, e.y, e.z),
|
67
|
-
new p(
|
67
|
+
new p(s.x, s.y, s.z)
|
68
68
|
);
|
69
69
|
}
|
70
|
-
if (
|
71
|
-
const { center: e, radius:
|
72
|
-
t.boundingSphere = new
|
70
|
+
if (n.boundingSphere != null) {
|
71
|
+
const { center: e, radius: s } = n.boundingSphere;
|
72
|
+
t.boundingSphere = new nt(
|
73
73
|
new p(e.x, e.y, e.z),
|
74
|
-
|
74
|
+
s
|
75
75
|
);
|
76
76
|
}
|
77
77
|
return t;
|
78
78
|
}
|
79
|
-
const
|
80
|
-
function
|
81
|
-
const t =
|
82
|
-
return
|
79
|
+
const yt = 128, gt = 128, wt = 64, Rt = "https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/9627216cc50057994c98a2118f3c4a23765d43b9/packages/core/assets/stbn.bin";
|
80
|
+
function mt(n) {
|
81
|
+
const t = n instanceof Int8Array ? "int8" : n instanceof Uint8Array || n instanceof Uint8ClampedArray ? "uint8" : n instanceof Int16Array ? "int16" : n instanceof Uint16Array ? "uint16" : n instanceof Int32Array ? "int32" : n instanceof Uint32Array ? "uint32" : n instanceof Float32Array ? "float32" : n instanceof Float64Array ? "float64" : null;
|
82
|
+
return W(t != null), t;
|
83
83
|
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
let L;
|
85
|
+
function xt() {
|
86
|
+
if (L != null)
|
87
|
+
return L;
|
88
|
+
const n = new Uint32Array([268435456]);
|
89
|
+
return L = new Uint8Array(n.buffer, n.byteOffset, n.byteLength)[0] === 0, L;
|
89
90
|
}
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
function g(n, t, e, s = !0) {
|
92
|
+
if (s === xt())
|
93
|
+
return new t(n);
|
94
|
+
const r = new DataView(n), i = new t(r.byteLength / t.BYTES_PER_ELEMENT);
|
95
|
+
for (let o = 0, a = 0; o < i.length; ++o, a += t.BYTES_PER_ELEMENT)
|
96
|
+
i[o] = r[e](a, s);
|
97
|
+
return i;
|
98
|
+
}
|
99
|
+
const Tt = (n) => new Uint8Array(n), Ct = (n) => new Int8Array(n), X = (n, t) => g(n, Uint16Array, "getUint16", t), k = (n, t) => g(n, Int16Array, "getInt16", t), Gt = (n, t) => g(n, Int32Array, "getInt32", t), qt = (n, t) => g(n, Uint32Array, "getUint32", t), F = (n, t) => g(n, Float32Array, "getFloat32", t), Ht = (n, t) => g(n, Float64Array, "getFloat64", t);
|
100
|
+
class At extends P {
|
101
|
+
load(t, e, s, r) {
|
102
|
+
const i = new ft(this.manager);
|
103
|
+
i.setRequestHeader(this.requestHeader), i.setPath(this.path), i.setWithCredentials(this.withCredentials), i.load(
|
95
104
|
t,
|
96
105
|
(o) => {
|
97
106
|
try {
|
98
107
|
e(this.parseTypedArray(o));
|
99
108
|
} catch (a) {
|
100
|
-
|
109
|
+
r != null ? r(a) : console.error(a), this.manager.itemError(t);
|
101
110
|
}
|
102
111
|
},
|
103
|
-
|
104
|
-
|
112
|
+
s,
|
113
|
+
r
|
105
114
|
);
|
106
115
|
}
|
107
116
|
}
|
108
|
-
function A(
|
109
|
-
return class extends
|
117
|
+
function A(n) {
|
118
|
+
return class extends At {
|
110
119
|
constructor() {
|
111
120
|
super(...arguments);
|
112
|
-
|
121
|
+
d(this, "parseTypedArray", n);
|
113
122
|
}
|
114
123
|
};
|
115
124
|
}
|
116
|
-
function
|
117
|
-
return new (A(
|
125
|
+
function Wt(n) {
|
126
|
+
return new (A(n))();
|
118
127
|
}
|
119
|
-
const
|
120
|
-
format:
|
121
|
-
wrapS:
|
122
|
-
wrapT:
|
123
|
-
minFilter:
|
124
|
-
magFilter:
|
128
|
+
const Xt = /* @__PURE__ */ A(k), kt = /* @__PURE__ */ A(X), jt = /* @__PURE__ */ A(F), Lt = {
|
129
|
+
format: ot,
|
130
|
+
wrapS: O,
|
131
|
+
wrapT: O,
|
132
|
+
minFilter: N,
|
133
|
+
magFilter: N
|
125
134
|
};
|
126
|
-
class
|
135
|
+
class St extends P {
|
127
136
|
constructor() {
|
128
137
|
super(...arguments);
|
129
|
-
|
138
|
+
d(this, "parameters", {});
|
130
139
|
}
|
131
|
-
load(e,
|
140
|
+
load(e, s, r, i) {
|
132
141
|
const o = new this.Texture(), a = new this.TypedArrayLoader(this.manager);
|
133
142
|
a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(this.withCredentials), a.load(
|
134
143
|
e,
|
135
144
|
(h) => {
|
136
145
|
o.image.data = h;
|
137
|
-
const { width: c, height: f, depth:
|
138
|
-
c != null && (o.image.width = c), f != null && (o.image.height = f), "depth" in o.image &&
|
139
|
-
const
|
140
|
-
o.type =
|
146
|
+
const { width: c, height: f, depth: y, ...I } = this.parameters;
|
147
|
+
c != null && (o.image.width = c), f != null && (o.image.height = f), "depth" in o.image && y != null && (o.image.depth = y);
|
148
|
+
const _ = mt(h);
|
149
|
+
o.type = _ === "uint8" ? st : _ === "int8" ? rt : it, Object.assign(o, I), o.needsUpdate = !0, s(o);
|
141
150
|
},
|
142
|
-
|
143
|
-
|
151
|
+
r,
|
152
|
+
i
|
144
153
|
);
|
145
154
|
}
|
146
155
|
}
|
147
|
-
function
|
148
|
-
return class extends
|
156
|
+
function j(n, t, e) {
|
157
|
+
return class extends St {
|
149
158
|
constructor() {
|
150
159
|
super(...arguments);
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
...
|
160
|
+
d(this, "Texture", n);
|
161
|
+
d(this, "TypedArrayLoader", A(t));
|
162
|
+
d(this, "parameters", {
|
163
|
+
...Lt,
|
155
164
|
...e
|
156
165
|
});
|
157
166
|
}
|
158
167
|
};
|
159
168
|
}
|
160
|
-
function
|
161
|
-
return
|
169
|
+
function v(n, t) {
|
170
|
+
return j(at, n, t);
|
162
171
|
}
|
163
|
-
function E(
|
164
|
-
return
|
172
|
+
function E(n, t) {
|
173
|
+
return j(ht, n, t);
|
165
174
|
}
|
166
|
-
function
|
167
|
-
return new (
|
175
|
+
function Vt(n, t) {
|
176
|
+
return new (v(n, t))();
|
168
177
|
}
|
169
|
-
function
|
170
|
-
return new (E(
|
178
|
+
function Qt(n, t) {
|
179
|
+
return new (E(n, t))();
|
171
180
|
}
|
172
|
-
const
|
173
|
-
function
|
174
|
-
|
181
|
+
const Yt = /* @__PURE__ */ E(k), $t = /* @__PURE__ */ E(X), Jt = /* @__PURE__ */ E(F), Zt = /* @__PURE__ */ v(F);
|
182
|
+
function Kt(n, ...t) {
|
183
|
+
const e = {};
|
184
|
+
for (let s = 0; s < t.length; s += 2) {
|
185
|
+
const r = t[s], i = t[s + 1];
|
186
|
+
for (const o of i)
|
187
|
+
e[o] = {
|
188
|
+
enumerable: !0,
|
189
|
+
get: () => r[o],
|
190
|
+
set: (a) => {
|
191
|
+
r[o] = a;
|
192
|
+
}
|
193
|
+
};
|
194
|
+
}
|
195
|
+
return Object.defineProperties(n, e), n;
|
196
|
+
}
|
197
|
+
function te(n, t, e) {
|
198
|
+
const s = {};
|
199
|
+
for (const r of e)
|
200
|
+
s[r] = {
|
201
|
+
enumerable: !0,
|
202
|
+
get: () => t.uniforms[r].value,
|
203
|
+
set: (i) => {
|
204
|
+
t.uniforms[r].value = i;
|
205
|
+
}
|
206
|
+
};
|
207
|
+
return Object.defineProperties(n, s), n;
|
208
|
+
}
|
209
|
+
const V = l.clamp, ee = l.euclideanModulo, ne = l.inverseLerp, se = l.lerp, re = l.degToRad, ie = l.radToDeg, oe = l.isPowerOfTwo, ae = l.ceilPowerOfTwo, he = l.floorPowerOfTwo, ce = l.normalize;
|
210
|
+
function le(n, t, e, s = 0, r = 1) {
|
211
|
+
return l.mapLinear(n, t, e, s, r);
|
212
|
+
}
|
213
|
+
function de(n, t, e, s = 0, r = 1) {
|
214
|
+
return V(l.mapLinear(n, t, e, s, r), s, r);
|
175
215
|
}
|
176
|
-
function
|
177
|
-
return
|
216
|
+
function ue(n, t, e) {
|
217
|
+
return e <= n ? 0 : e >= t ? 1 : (e = (e - n) / (t - n), e * e * (3 - 2 * e));
|
178
218
|
}
|
179
|
-
function
|
180
|
-
|
181
|
-
return i <= n || i <= e * Math.max(Math.abs(s), Math.abs(t));
|
219
|
+
function pe(n) {
|
220
|
+
return Math.min(Math.max(n, 0), 1);
|
182
221
|
}
|
183
|
-
|
184
|
-
|
185
|
-
|
222
|
+
function fe(n, t, e, s = e) {
|
223
|
+
const r = Math.abs(n - t);
|
224
|
+
return r <= s || r <= e * Math.max(Math.abs(n), Math.abs(t));
|
225
|
+
}
|
226
|
+
const U = 1e-6, S = /* @__PURE__ */ new p(), b = /* @__PURE__ */ new p(), u = /* @__PURE__ */ new p(), m = /* @__PURE__ */ new p(), z = /* @__PURE__ */ new p(), bt = /* @__PURE__ */ new p(), Mt = /* @__PURE__ */ new lt(), Et = /* @__PURE__ */ new ct(), It = /* @__PURE__ */ new dt();
|
227
|
+
class Q {
|
228
|
+
constructor(t = 0, e = 0, s = 0, r = 0) {
|
186
229
|
// Distance from the target.
|
187
|
-
|
230
|
+
d(this, "_distance");
|
188
231
|
// Radians from the local east direction relative from true north, measured
|
189
232
|
// clockwise (90 degrees is true north, and -90 is true south).
|
190
|
-
|
233
|
+
d(this, "heading");
|
191
234
|
// Radians from the local horizon plane, measured with positive values looking
|
192
235
|
// up (90 degrees is straight up, -90 is straight down).
|
193
|
-
|
194
|
-
|
195
|
-
this.distance = t, this.heading = e, this.pitch =
|
236
|
+
d(this, "_pitch");
|
237
|
+
d(this, "roll");
|
238
|
+
this.distance = t, this.heading = e, this.pitch = s, this.roll = r;
|
196
239
|
}
|
197
240
|
get distance() {
|
198
241
|
return this._distance;
|
199
242
|
}
|
200
243
|
set distance(t) {
|
201
|
-
this._distance = Math.max(t,
|
244
|
+
this._distance = Math.max(t, U);
|
202
245
|
}
|
203
246
|
get pitch() {
|
204
247
|
return this._pitch;
|
205
248
|
}
|
206
249
|
set pitch(t) {
|
207
|
-
this._pitch =
|
250
|
+
this._pitch = V(t, -Math.PI / 2 + U, Math.PI / 2 - U);
|
208
251
|
}
|
209
|
-
set(t, e,
|
210
|
-
return this.distance = t, this.heading = e, this.pitch =
|
252
|
+
set(t, e, s, r) {
|
253
|
+
return this.distance = t, this.heading = e, this.pitch = s, r != null && (this.roll = r), this;
|
211
254
|
}
|
212
255
|
clone() {
|
213
|
-
return new
|
256
|
+
return new Q(this.distance, this.heading, this.pitch, this.roll);
|
214
257
|
}
|
215
258
|
copy(t) {
|
216
259
|
return this.distance = t.distance, this.heading = t.heading, this.pitch = t.pitch, this.roll = t.roll, this;
|
@@ -218,46 +261,46 @@ class W {
|
|
218
261
|
equals(t) {
|
219
262
|
return t.distance === this.distance && t.heading === this.heading && t.pitch === this.pitch && t.roll === this.roll;
|
220
263
|
}
|
221
|
-
decompose(t, e,
|
222
|
-
|
264
|
+
decompose(t, e, s, r, i = C.WGS84) {
|
265
|
+
i.getEastNorthUpVectors(
|
223
266
|
t,
|
224
|
-
L,
|
225
267
|
S,
|
268
|
+
b,
|
226
269
|
u
|
227
|
-
),
|
228
|
-
const o = m.copy(
|
229
|
-
z.copy(
|
270
|
+
), r == null || r.copy(u);
|
271
|
+
const o = m.copy(S).multiplyScalar(Math.cos(this.heading)).add(
|
272
|
+
z.copy(b).multiplyScalar(Math.sin(this.heading))
|
230
273
|
).multiplyScalar(Math.cos(this.pitch)).add(z.copy(u).multiplyScalar(Math.sin(this.pitch))).normalize().multiplyScalar(this.distance);
|
231
274
|
if (e.copy(t).sub(o), this.roll !== 0) {
|
232
275
|
const a = m.copy(t).sub(e).normalize();
|
233
276
|
u.applyQuaternion(
|
234
|
-
|
277
|
+
Et.setFromAxisAngle(a, this.roll)
|
235
278
|
);
|
236
279
|
}
|
237
|
-
|
238
|
-
|
280
|
+
s.setFromRotationMatrix(
|
281
|
+
Mt.lookAt(e, t, u)
|
239
282
|
);
|
240
283
|
}
|
241
|
-
setFromCamera(t, e =
|
242
|
-
const
|
243
|
-
if (
|
284
|
+
setFromCamera(t, e = C.WGS84) {
|
285
|
+
const s = m.setFromMatrixPosition(t.matrixWorld), r = z.set(0, 0, 0.5).unproject(t).sub(s).normalize(), i = e.getIntersection(It.set(s, r));
|
286
|
+
if (i == null)
|
244
287
|
return;
|
245
|
-
this.distance =
|
246
|
-
|
247
|
-
L,
|
288
|
+
this.distance = s.distanceTo(i), e.getEastNorthUpVectors(
|
289
|
+
i,
|
248
290
|
S,
|
291
|
+
b,
|
249
292
|
u
|
250
293
|
), this.heading = Math.atan2(
|
251
|
-
|
252
|
-
|
253
|
-
), this.pitch = Math.asin(u.dot(
|
254
|
-
const o = m.copy(t.up).applyQuaternion(t.quaternion), a =
|
294
|
+
b.dot(r),
|
295
|
+
S.dot(r)
|
296
|
+
), this.pitch = Math.asin(u.dot(r));
|
297
|
+
const o = m.copy(t.up).applyQuaternion(t.quaternion), a = bt.copy(r).multiplyScalar(-o.dot(r)).add(o).normalize(), h = m.copy(r).multiplyScalar(-u.dot(r)).add(u).normalize(), c = h.dot(a), f = r.dot(h.cross(a));
|
255
298
|
return this.roll = Math.atan2(f, c), this;
|
256
299
|
}
|
257
300
|
}
|
258
301
|
const x = class x {
|
259
|
-
constructor(t = 0, e = 0,
|
260
|
-
this.west = t, this.south = e, this.east =
|
302
|
+
constructor(t = 0, e = 0, s = 0, r = 0) {
|
303
|
+
this.west = t, this.south = e, this.east = s, this.north = r;
|
261
304
|
}
|
262
305
|
get width() {
|
263
306
|
let t = this.east;
|
@@ -266,8 +309,8 @@ const x = class x {
|
|
266
309
|
get height() {
|
267
310
|
return this.north - this.south;
|
268
311
|
}
|
269
|
-
set(t, e,
|
270
|
-
return this.west = t, this.south = e, this.east =
|
312
|
+
set(t, e, s, r) {
|
313
|
+
return this.west = t, this.south = e, this.east = s, this.north = r, this;
|
271
314
|
}
|
272
315
|
clone() {
|
273
316
|
return new x(this.west, this.south, this.east, this.north);
|
@@ -278,8 +321,8 @@ const x = class x {
|
|
278
321
|
equals(t) {
|
279
322
|
return t.west === this.west && t.south === this.south && t.east === this.east && t.north === this.north;
|
280
323
|
}
|
281
|
-
at(t, e,
|
282
|
-
return
|
324
|
+
at(t, e, s = new w()) {
|
325
|
+
return s.set(
|
283
326
|
this.west + (this.east - this.west) * t,
|
284
327
|
this.north + (this.south - this.north) * e
|
285
328
|
);
|
@@ -294,48 +337,59 @@ const x = class x {
|
|
294
337
|
yield this.west, yield this.south, yield this.east, yield this.north;
|
295
338
|
}
|
296
339
|
};
|
297
|
-
|
340
|
+
d(x, "MAX", /* @__PURE__ */ new x(
|
298
341
|
w.MIN_LONGITUDE,
|
299
342
|
w.MIN_LATITUDE,
|
300
343
|
w.MAX_LONGITUDE,
|
301
344
|
w.MAX_LATITUDE
|
302
345
|
));
|
303
346
|
let M = x;
|
304
|
-
const
|
305
|
-
function
|
306
|
-
return
|
307
|
-
const
|
347
|
+
const Dt = /^[ \t]*#include +"([\w\d./]+)"/gm;
|
348
|
+
function Ut(n, t) {
|
349
|
+
return n.replace(Dt, (e, s) => {
|
350
|
+
const i = s.split("/").reduce(
|
308
351
|
(o, a) => typeof o != "string" && o != null ? o[a] : void 0,
|
309
352
|
t
|
310
353
|
);
|
311
|
-
if (typeof
|
312
|
-
throw new Error(`Could not find include for ${
|
313
|
-
return
|
354
|
+
if (typeof i != "string")
|
355
|
+
throw new Error(`Could not find include for ${s}.`);
|
356
|
+
return Ut(i, t);
|
314
357
|
});
|
315
358
|
}
|
316
|
-
|
317
|
-
|
359
|
+
const ye = v(Tt, {
|
360
|
+
format: ut,
|
361
|
+
minFilter: R,
|
362
|
+
magFilter: R,
|
363
|
+
wrapS: D,
|
364
|
+
wrapT: D,
|
365
|
+
wrapR: D,
|
366
|
+
width: yt,
|
367
|
+
height: gt,
|
368
|
+
depth: wt
|
369
|
+
});
|
370
|
+
function* Y(n, t, e, s, r) {
|
371
|
+
if (e >= s)
|
318
372
|
return;
|
319
|
-
const
|
373
|
+
const i = 2 ** e, o = e + 1, a = 2 ** o, h = Math.floor(n / i * a), c = Math.floor(t / i * a), f = [
|
320
374
|
[h, c, o],
|
321
375
|
[h + 1, c, o],
|
322
376
|
[h, c + 1, o],
|
323
377
|
[h + 1, c + 1, o]
|
324
378
|
];
|
325
|
-
if (o <
|
326
|
-
for (const
|
327
|
-
for (const I of
|
379
|
+
if (o < s)
|
380
|
+
for (const y of f)
|
381
|
+
for (const I of Y(...y, s, r))
|
328
382
|
yield I;
|
329
383
|
else
|
330
|
-
for (const
|
331
|
-
yield (
|
384
|
+
for (const y of f)
|
385
|
+
yield (r ?? new T()).set(...y);
|
332
386
|
}
|
333
387
|
class T {
|
334
|
-
constructor(t = 0, e = 0,
|
335
|
-
this.x = t, this.y = e, this.z =
|
388
|
+
constructor(t = 0, e = 0, s = 0) {
|
389
|
+
this.x = t, this.y = e, this.z = s;
|
336
390
|
}
|
337
|
-
set(t, e,
|
338
|
-
return this.x = t, this.y = e,
|
391
|
+
set(t, e, s) {
|
392
|
+
return this.x = t, this.y = e, s != null && (this.z = s), this;
|
339
393
|
}
|
340
394
|
clone() {
|
341
395
|
return new T(this.x, this.y, this.z);
|
@@ -347,12 +401,12 @@ class T {
|
|
347
401
|
return t.x === this.x && t.y === this.y && t.z === this.z;
|
348
402
|
}
|
349
403
|
getParent(t = new T()) {
|
350
|
-
const e = 2 ** this.z,
|
351
|
-
return t.set(Math.floor(
|
404
|
+
const e = 2 ** this.z, s = this.x / e, r = this.y / e, i = this.z - 1, o = 2 ** i;
|
405
|
+
return t.set(Math.floor(s * o), Math.floor(r * o), i);
|
352
406
|
}
|
353
407
|
*traverseChildren(t, e) {
|
354
|
-
const { x:
|
355
|
-
for (const o of
|
408
|
+
const { x: s, y: r, z: i } = this;
|
409
|
+
for (const o of Y(s, r, i, i + t, e))
|
356
410
|
yield o;
|
357
411
|
}
|
358
412
|
fromArray(t, e = 0) {
|
@@ -365,100 +419,105 @@ class T {
|
|
365
419
|
yield this.x, yield this.y, yield this.z;
|
366
420
|
}
|
367
421
|
}
|
368
|
-
const
|
369
|
-
class
|
370
|
-
constructor(t = 2, e = 1,
|
371
|
-
this.width = t, this.height = e, this.rectangle =
|
422
|
+
const q = /* @__PURE__ */ new H();
|
423
|
+
class $ {
|
424
|
+
constructor(t = 2, e = 1, s = M.MAX) {
|
425
|
+
this.width = t, this.height = e, this.rectangle = s;
|
372
426
|
}
|
373
427
|
clone() {
|
374
|
-
return new
|
428
|
+
return new $(this.width, this.height, this.rectangle.clone());
|
375
429
|
}
|
376
430
|
copy(t) {
|
377
431
|
return this.width = t.width, this.height = t.height, this.rectangle.copy(t.rectangle), this;
|
378
432
|
}
|
379
|
-
getSize(t, e = new
|
433
|
+
getSize(t, e = new H()) {
|
380
434
|
return e.set(this.width << t, this.height << t);
|
381
435
|
}
|
382
436
|
// Reference: https://github.com/CesiumGS/cesium/blob/1.122/packages/engine/Source/Core/GeographicTilingScheme.js#L210
|
383
|
-
getTile(t, e,
|
384
|
-
const
|
437
|
+
getTile(t, e, s = new T()) {
|
438
|
+
const r = this.getSize(e, q), i = this.rectangle.width / r.x, o = this.rectangle.height / r.y;
|
385
439
|
let a = t.longitude;
|
386
440
|
this.rectangle.east < this.rectangle.west && (a += Math.PI * 2);
|
387
|
-
let h = Math.floor((a - this.rectangle.west) /
|
388
|
-
h >=
|
441
|
+
let h = Math.floor((a - this.rectangle.west) / i);
|
442
|
+
h >= r.x && (h = r.x - 1);
|
389
443
|
let c = Math.floor((t.latitude - this.rectangle.south) / o);
|
390
|
-
return c >=
|
444
|
+
return c >= r.y && (c = r.y - 1), s.x = h, s.y = c, s.z = e, s;
|
391
445
|
}
|
392
446
|
// Reference: https://github.com/CesiumGS/cesium/blob/1.122/packages/engine/Source/Core/GeographicTilingScheme.js#L169
|
393
447
|
getRectangle(t, e = new M()) {
|
394
|
-
const
|
395
|
-
return e.west = t.x *
|
448
|
+
const s = this.getSize(t.z, q), r = this.rectangle.width / s.x, i = this.rectangle.height / s.y;
|
449
|
+
return e.west = t.x * r + this.rectangle.west, e.east = (t.x + 1) * r + this.rectangle.west, e.north = this.rectangle.north - (s.y - t.y - 1) * i, e.south = this.rectangle.north - (s.y - t.y) * i, e;
|
396
450
|
}
|
397
451
|
}
|
398
|
-
const
|
399
|
-
function
|
400
|
-
let
|
401
|
-
for (let
|
402
|
-
|
403
|
-
return
|
452
|
+
const zt = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*(?:i\s*\+\+|\+\+\s*i)\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
|
453
|
+
function Pt(n, t, e, s) {
|
454
|
+
let r = "";
|
455
|
+
for (let i = parseInt(t); i < parseInt(e); ++i)
|
456
|
+
r += s.replace(/\[\s*i\s*\]/g, "[" + i + "]").replace(/UNROLLED_LOOP_INDEX/g, `${i}`);
|
457
|
+
return r;
|
404
458
|
}
|
405
|
-
function
|
406
|
-
return
|
459
|
+
function ge(n) {
|
460
|
+
return n.replace(zt, Pt);
|
407
461
|
}
|
408
462
|
export {
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
463
|
+
ft as ArrayBufferLoader,
|
464
|
+
Rt as DEFAULT_STBN_URL,
|
465
|
+
St as DataLoader,
|
466
|
+
C as Ellipsoid,
|
467
|
+
xe as EllipsoidGeometry,
|
468
|
+
jt as Float32ArrayLoader,
|
469
|
+
Jt as Float32Data2DLoader,
|
470
|
+
Zt as Float32Data3DLoader,
|
416
471
|
w as Geodetic,
|
417
|
-
|
418
|
-
|
419
|
-
|
472
|
+
Xt as Int16ArrayLoader,
|
473
|
+
Yt as Int16Data2DLoader,
|
474
|
+
Q as PointOfView,
|
420
475
|
M as Rectangle,
|
421
|
-
|
422
|
-
|
423
|
-
|
476
|
+
ye as STBNLoader,
|
477
|
+
wt as STBN_TEXTURE_DEPTH,
|
478
|
+
gt as STBN_TEXTURE_HEIGHT,
|
479
|
+
yt as STBN_TEXTURE_WIDTH,
|
424
480
|
T as TileCoordinate,
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
481
|
+
$ as TilingScheme,
|
482
|
+
At as TypedArrayLoader,
|
483
|
+
kt as Uint16ArrayLoader,
|
484
|
+
$t as Uint16Data2DLoader,
|
485
|
+
Bt as assertType,
|
486
|
+
ae as ceilPowerOfTwo,
|
487
|
+
V as clamp,
|
488
|
+
fe as closeTo,
|
489
|
+
Vt as createData3DTextureLoader,
|
490
|
+
v as createData3DTextureLoaderClass,
|
491
|
+
Qt as createDataTextureLoader,
|
436
492
|
E as createDataTextureLoaderClass,
|
437
|
-
|
493
|
+
Wt as createTypedArrayLoader,
|
438
494
|
A as createTypedArrayLoaderClass,
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
495
|
+
Kt as definePropertyShorthand,
|
496
|
+
te as defineUniformShorthand,
|
497
|
+
ie as degrees,
|
498
|
+
ee as euclideanModulo,
|
499
|
+
he as floorPowerOfTwo,
|
500
|
+
Ot as fromBufferGeometryLike,
|
501
|
+
mt as getTypedArrayElementType,
|
502
|
+
ne as inverseLerp,
|
503
|
+
oe as isPowerOfTwo,
|
504
|
+
se as lerp,
|
505
|
+
ce as normalize,
|
506
|
+
F as parseFloat32Array,
|
507
|
+
Ht as parseFloat64Array,
|
508
|
+
k as parseInt16Array,
|
509
|
+
Gt as parseInt32Array,
|
510
|
+
Ct as parseInt8Array,
|
511
|
+
X as parseUint16Array,
|
512
|
+
qt as parseUint32Array,
|
513
|
+
Tt as parseUint8Array,
|
514
|
+
re as radians,
|
515
|
+
le as remap,
|
516
|
+
de as remapClamped,
|
517
|
+
Ut as resolveIncludes,
|
518
|
+
pe as saturate,
|
519
|
+
ue as smoothstep,
|
520
|
+
Nt as toBufferGeometryLike,
|
521
|
+
ge as unrollLoops
|
463
522
|
};
|
464
523
|
//# sourceMappingURL=index.js.map
|