a3js 0.0.13 → 0.0.14
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/a3js.cjs.js +5 -5
- package/dist/a3js.es.js +530 -429
- package/package.json +1 -1
package/dist/a3js.es.js
CHANGED
|
@@ -1,20 +1,95 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { ShapePath as
|
|
1
|
+
import * as R from "three";
|
|
2
|
+
import { ShapePath as Ct, ExtrudeGeometry as It, TrianglesDrawMode as kt, TriangleFanDrawMode as Le, TriangleStripDrawMode as et, Loader as tt, LoaderUtils as ie, FileLoader as he, MeshPhysicalMaterial as G, Vector2 as st, Color as X, LinearSRGBColorSpace as U, SRGBColorSpace as K, SpotLight as Nt, PointLight as Dt, DirectionalLight as Pt, Matrix4 as ue, Vector3 as q, Quaternion as nt, InstancedMesh as Ot, InstancedBufferAttribute as Ft, Object3D as it, TextureLoader as Ht, ImageBitmapLoader as Ut, BufferAttribute as re, InterleavedBuffer as rt, InterleavedBufferAttribute as ot, LinearMipmapLinearFilter as at, NearestMipmapLinearFilter as Gt, LinearMipmapNearestFilter as Bt, NearestMipmapNearestFilter as zt, LinearFilter as Ae, NearestFilter as ct, RepeatWrapping as Se, MirroredRepeatWrapping as jt, ClampToEdgeWrapping as Kt, PointsMaterial as Xt, Material as ge, LineBasicMaterial as Wt, MeshStandardMaterial as lt, DoubleSide as Vt, MeshBasicMaterial as ne, PropertyBinding as Yt, BufferGeometry as ht, SkinnedMesh as $t, Mesh as qt, LineSegments as Jt, Line as Qt, LineLoop as Zt, Points as es, Group as ye, PerspectiveCamera as ts, MathUtils as ss, OrthographicCamera as ns, Skeleton as is, AnimationClip as rs, Bone as os, InterpolateDiscrete as as, InterpolateLinear as ut, Texture as Ke, VectorKeyframeTrack as Xe, NumberKeyframeTrack as We, QuaternionKeyframeTrack as Ve, ColorManagement as Me, FrontSide as cs, Interpolant as ls, Box3 as hs, Sphere as us } from "three";
|
|
3
|
+
class V {
|
|
4
|
+
static RAPIER;
|
|
5
|
+
isInitialized = !1;
|
|
6
|
+
constructor() {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* RapierWorldを作って返す。RAPIERの初期化が済んでない時には
|
|
10
|
+
* まずその初期化から。動的インポート使う。
|
|
11
|
+
*/
|
|
12
|
+
async createWorld(e) {
|
|
13
|
+
if (!V.RAPIER) {
|
|
14
|
+
const s = await import("@dimforge/rapier3d-compat");
|
|
15
|
+
await s.init(), V.RAPIER = s, this.isInitialized = !0;
|
|
16
|
+
}
|
|
17
|
+
let t = 1 / 60;
|
|
18
|
+
this.isRapierOption(e) && (t = e.timestep);
|
|
19
|
+
const n = new V.RAPIER.World(e.gravity);
|
|
20
|
+
return new fs(n, t);
|
|
21
|
+
}
|
|
22
|
+
isRapierOption(e) {
|
|
23
|
+
return "enableCCD" in e && "timestep" in e;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
3
26
|
class fs {
|
|
27
|
+
world;
|
|
28
|
+
timestep;
|
|
29
|
+
constructor(e, t) {
|
|
30
|
+
this.world = e, this.timestep = t, this.world.integrationParameters.dt = this.timestep;
|
|
31
|
+
}
|
|
32
|
+
add(e) {
|
|
33
|
+
Ye(e) && e.addOneself(this);
|
|
34
|
+
}
|
|
35
|
+
remove(e) {
|
|
36
|
+
Ye(e) && e.removeOneself(this);
|
|
37
|
+
}
|
|
38
|
+
update(e) {
|
|
39
|
+
const t = Math.ceil(e / this.timestep);
|
|
40
|
+
for (let n = 0; n < t; n++)
|
|
41
|
+
this.world.step();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function Ye(o) {
|
|
45
|
+
return "addOneself" in o && "removeOneself" in o;
|
|
46
|
+
}
|
|
47
|
+
class J {
|
|
48
|
+
scene;
|
|
49
|
+
objects;
|
|
50
|
+
static physics;
|
|
51
|
+
physicsWorld = null;
|
|
52
|
+
physicsDt = 1 / 60;
|
|
53
|
+
constructor() {
|
|
54
|
+
this.scene = new R.Scene(), this.objects = [], J.physics || (J.physics = new V());
|
|
55
|
+
}
|
|
56
|
+
add(e) {
|
|
57
|
+
this.scene.add(e.object), this.objects.push(e), e.scene = this, e.controlMode === "physics" && (this.physicsWorld || queueMicrotask(async () => {
|
|
58
|
+
this.physicsWorld || (this.physicsWorld = await J.physics.createWorld({
|
|
59
|
+
gravity: { x: 0, y: -9.81, z: 0 },
|
|
60
|
+
timestep: this.physicsDt
|
|
61
|
+
})), e.physics || e.initPhysics(J.physics, this.physicsWorld), e.physics && this.physicsWorld.add(e.physics);
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
remove(e) {
|
|
65
|
+
this.scene.remove(e.object);
|
|
66
|
+
{
|
|
67
|
+
const t = this.objects.indexOf(e);
|
|
68
|
+
this.objects[t] = this.objects[this.objects.length - 1], this.objects.pop();
|
|
69
|
+
}
|
|
70
|
+
e.scene = null, e.controlMode === "physics" && this.physicsWorld && e.physics && this.physicsWorld.remove(e.physics);
|
|
71
|
+
}
|
|
72
|
+
update(e) {
|
|
73
|
+
this.physicsWorld && this.physicsWorld.update(e);
|
|
74
|
+
for (const t of this.objects)
|
|
75
|
+
t.controlMode !== "manual" && t.update(e);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
class ds {
|
|
4
79
|
obj;
|
|
5
80
|
constructor(e) {
|
|
6
81
|
this.obj = e, console.log(`A3PhysicsEntityDummy is created!(maybe wrong) This may be related to Class ${typeof this.obj}`);
|
|
7
82
|
}
|
|
8
83
|
synchronize(e) {
|
|
9
84
|
}
|
|
10
|
-
|
|
85
|
+
forceSetLoc(e) {
|
|
11
86
|
}
|
|
12
|
-
|
|
87
|
+
forceSetQuat(e) {
|
|
13
88
|
}
|
|
14
|
-
|
|
89
|
+
forceSetScale(e) {
|
|
15
90
|
}
|
|
16
91
|
}
|
|
17
|
-
class
|
|
92
|
+
class D {
|
|
18
93
|
_x;
|
|
19
94
|
_y;
|
|
20
95
|
_z;
|
|
@@ -41,7 +116,7 @@ class F {
|
|
|
41
116
|
this._x = (1 - n) * e.x + n * t.x, this._y = (1 - n) * e.y + n * t.y, this._z = (1 - n) * e.z + n * t.z;
|
|
42
117
|
}
|
|
43
118
|
}
|
|
44
|
-
class
|
|
119
|
+
class Z {
|
|
45
120
|
_x;
|
|
46
121
|
_y;
|
|
47
122
|
_z;
|
|
@@ -87,58 +162,12 @@ class re {
|
|
|
87
162
|
}
|
|
88
163
|
}
|
|
89
164
|
}
|
|
90
|
-
class ds {
|
|
91
|
-
message;
|
|
92
|
-
dir;
|
|
93
|
-
offsetTop;
|
|
94
|
-
offsetRight;
|
|
95
|
-
offsetLeft;
|
|
96
|
-
offsetBottom;
|
|
97
|
-
constructor(e) {
|
|
98
|
-
this.message = e, this.dir = "RIGHT", this.offsetTop = { x: 0, y: 2 }, this.offsetRight = { x: 1, y: 1 }, this.offsetLeft = { x: -1, y: 1 }, this.offsetBottom = { x: 0, y: 0 };
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
class ps {
|
|
102
|
-
firstLoc;
|
|
103
|
-
firstRot;
|
|
104
|
-
firstScale;
|
|
105
|
-
nowLoc;
|
|
106
|
-
nowRot;
|
|
107
|
-
nowScale;
|
|
108
|
-
lastLoc;
|
|
109
|
-
lastRot;
|
|
110
|
-
lastScale;
|
|
111
|
-
nowTime;
|
|
112
|
-
duration;
|
|
113
|
-
constructor(e) {
|
|
114
|
-
this.firstLoc = new F(e.location), this.firstRot = new re(e.rot), this.firstScale = new F(e.scale), this.nowLoc = new F(e.location), this.nowRot = new re(e.rot), this.nowScale = new F(e.scale), this.lastLoc = new F(e.location), this.lastRot = new re(e.rot), this.lastScale = new F(e.scale), this.nowTime = 0, this.duration = 1;
|
|
115
|
-
}
|
|
116
|
-
setLoc(e, t) {
|
|
117
|
-
this.firstLoc.set(e.location), this.firstRot.set(e.rot), this.firstScale.set(e.scale), this.lastLoc.set(t), this.nowTime = 0;
|
|
118
|
-
}
|
|
119
|
-
setQuat(e, t) {
|
|
120
|
-
this.firstLoc.set(e.location), this.firstRot.set(e.rot), this.firstScale.set(e.scale), this.lastRot.set(t), this.nowTime = 0;
|
|
121
|
-
}
|
|
122
|
-
setScale(e, t) {
|
|
123
|
-
this.firstLoc.set(e.location), this.firstRot.set(e.rot), this.firstScale.set(e.scale), this.lastScale.set(t), this.nowTime = 0;
|
|
124
|
-
}
|
|
125
|
-
// cssのanimation-timing-functionみたいに
|
|
126
|
-
// 切り替えられるようにしたいね。
|
|
127
|
-
smoothstep(e) {
|
|
128
|
-
return e * e * (3 - 2 * e);
|
|
129
|
-
}
|
|
130
|
-
interpolate(e, t) {
|
|
131
|
-
this.nowTime += t, this.nowTime > this.duration && (this.nowTime = this.duration);
|
|
132
|
-
const n = this.nowTime / this.duration, s = this.smoothstep(n);
|
|
133
|
-
this.nowLoc.lerp(this.firstLoc, this.lastLoc, s), this.nowRot.slerp(this.firstRot, this.lastRot, s), this.nowScale.lerp(this.firstScale, this.lastScale, s), e.location.set(this.nowLoc), e.object.position.set(this.nowLoc.x, this.nowLoc.y, this.nowLoc.z), e.rot.set(this.nowRot), e.object.quaternion.set(this.nowRot.x, this.nowRot.y, this.nowRot.z, this.nowRot.w), e.scale.set(this.nowScale), e.object.scale.set(this.nowScale.x, this.nowScale.y, this.nowScale.z);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
165
|
class ae {
|
|
137
|
-
_loc = new
|
|
138
|
-
_rot = new
|
|
139
|
-
_scale = new
|
|
166
|
+
_loc = new D(0, 0, 0);
|
|
167
|
+
_rot = new Z(0, 0, 0, 1);
|
|
168
|
+
_scale = new D(1, 1, 1);
|
|
140
169
|
object;
|
|
141
|
-
|
|
170
|
+
controlMode = "manual";
|
|
142
171
|
scene = null;
|
|
143
172
|
physics = null;
|
|
144
173
|
balloon = null;
|
|
@@ -146,11 +175,13 @@ class ae {
|
|
|
146
175
|
constructor(e) {
|
|
147
176
|
this.object = this.initObject(e);
|
|
148
177
|
}
|
|
149
|
-
|
|
150
|
-
this.
|
|
178
|
+
setControlMode(e) {
|
|
179
|
+
this.controlMode = e, e === "interpolated" && !this.interpolation && (this.interpolation = new ms(this));
|
|
151
180
|
}
|
|
152
181
|
update(e) {
|
|
153
|
-
switch (this.
|
|
182
|
+
switch (this.controlMode) {
|
|
183
|
+
case "manual":
|
|
184
|
+
break;
|
|
154
185
|
case "interpolated":
|
|
155
186
|
this.interpolation && this.interpolation.interpolate(this, e);
|
|
156
187
|
break;
|
|
@@ -170,142 +201,174 @@ class ae {
|
|
|
170
201
|
* スーパークラスでオーバーライドして実装するべき。
|
|
171
202
|
*/
|
|
172
203
|
initPhysics(e, t) {
|
|
173
|
-
e && console.log(`physics: ${typeof e}`), t && console.log(`world: ${typeof t}`), this.physics = new
|
|
204
|
+
e && console.log(`physics: ${typeof e}`), t && console.log(`world: ${typeof t}`), this.physics = new ds(this);
|
|
174
205
|
}
|
|
175
206
|
setBalloon(e) {
|
|
176
|
-
this.balloon ? this.balloon.message = e : this.balloon = new
|
|
207
|
+
this.balloon ? this.balloon.message = e : this.balloon = new ps(e);
|
|
208
|
+
}
|
|
209
|
+
get location() {
|
|
210
|
+
return this._loc;
|
|
177
211
|
}
|
|
178
212
|
setLocation(e, t, n) {
|
|
179
|
-
const s = new
|
|
180
|
-
switch (typeof e == "number" ? s.set(e, t, n) : s.set(e), this.
|
|
213
|
+
const s = new D();
|
|
214
|
+
switch (typeof e == "number" ? s.set(e, t, n) : s.set(e), this.controlMode) {
|
|
181
215
|
case "interpolated":
|
|
182
216
|
this.interpolation && this.interpolation.setLoc(this, s);
|
|
183
217
|
break;
|
|
184
218
|
case "physics":
|
|
185
|
-
this.physics && this.physics.setLoc(s);
|
|
186
219
|
break;
|
|
187
220
|
default:
|
|
188
221
|
this.location.set(s), this.object.position.set(s.x, s.y, s.z);
|
|
189
222
|
break;
|
|
190
223
|
}
|
|
191
224
|
}
|
|
192
|
-
|
|
193
|
-
|
|
225
|
+
forceSetLocation(e, t, n) {
|
|
226
|
+
const s = new D();
|
|
227
|
+
switch (typeof e == "number" ? s.set(e, t, n) : s.set(e), this.controlMode) {
|
|
228
|
+
case "interpolated":
|
|
229
|
+
this.interpolation && this.interpolation.forceSetLoc(this, s);
|
|
230
|
+
break;
|
|
231
|
+
case "physics":
|
|
232
|
+
this.physics && this.physics.forceSetLoc(s);
|
|
233
|
+
break;
|
|
234
|
+
default:
|
|
235
|
+
this.location.set(s), this.object.position.set(s.x, s.y, s.z);
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
get rot() {
|
|
240
|
+
return this._rot;
|
|
194
241
|
}
|
|
195
242
|
setQuat(e, t, n, s) {
|
|
196
|
-
const i = new
|
|
197
|
-
switch (typeof e == "number" ? i.set(e, t, n, s) : i.set(e), this.
|
|
243
|
+
const i = new Z();
|
|
244
|
+
switch (typeof e == "number" ? i.set(e, t, n, s) : i.set(e), this.controlMode) {
|
|
198
245
|
case "interpolated":
|
|
199
246
|
this.interpolation && this.interpolation.setQuat(this, i);
|
|
200
247
|
break;
|
|
201
248
|
case "physics":
|
|
202
|
-
this.physics && this.physics.setQuat(i);
|
|
203
249
|
break;
|
|
204
250
|
default:
|
|
205
251
|
this.rot.set(i), this.object.quaternion.set(i.x, i.y, i.z, i.w);
|
|
206
252
|
break;
|
|
207
253
|
}
|
|
208
254
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
setScale(e, t, n) {
|
|
213
|
-
const s = new F();
|
|
214
|
-
switch (typeof e == "number" ? s.set(e, t, n) : s.set(e), this.motionControlMode) {
|
|
255
|
+
forceSetQuat(e, t, n, s) {
|
|
256
|
+
const i = new Z();
|
|
257
|
+
switch (typeof e == "number" ? i.set(e, t, n, s) : i.set(e), this.controlMode) {
|
|
215
258
|
case "interpolated":
|
|
216
|
-
this.interpolation && this.interpolation.
|
|
259
|
+
this.interpolation && this.interpolation.forceSetQuat(this, i);
|
|
217
260
|
break;
|
|
218
261
|
case "physics":
|
|
219
|
-
this.physics && this.physics.
|
|
262
|
+
this.physics && this.physics.forceSetQuat(i);
|
|
263
|
+
break;
|
|
264
|
+
default:
|
|
265
|
+
this.rot.set(i), this.object.quaternion.set(i.x, i.y, i.z, i.w);
|
|
220
266
|
break;
|
|
221
267
|
}
|
|
222
268
|
}
|
|
223
269
|
get scale() {
|
|
224
270
|
return this._scale;
|
|
225
271
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
272
|
+
setScale(e, t, n) {
|
|
273
|
+
const s = new D();
|
|
274
|
+
switch (typeof e == "number" ? s.set(e, t, n) : s.set(e), this.controlMode) {
|
|
275
|
+
case "interpolated":
|
|
276
|
+
this.interpolation && this.interpolation.setScale(this, s);
|
|
277
|
+
break;
|
|
278
|
+
case "physics":
|
|
279
|
+
break;
|
|
280
|
+
default:
|
|
281
|
+
this.scale.set(s), this.object.scale.set(s.x, s.y, s.z);
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
231
284
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
285
|
+
forceSetScale(e, t, n) {
|
|
286
|
+
const s = new D();
|
|
287
|
+
switch (typeof e == "number" ? s.set(e, t, n) : s.set(e), this.controlMode) {
|
|
288
|
+
case "interpolated":
|
|
289
|
+
this.interpolation && this.interpolation.forceSetScale(this, s);
|
|
290
|
+
break;
|
|
291
|
+
case "physics":
|
|
292
|
+
this.physics && this.physics.forceSetScale(s);
|
|
293
|
+
break;
|
|
294
|
+
default:
|
|
295
|
+
this.scale.set(s), this.object.scale.set(s.x, s.y, s.z);
|
|
296
|
+
break;
|
|
240
297
|
}
|
|
241
|
-
let t = 1 / 60;
|
|
242
|
-
this.isRapierOption(e) && (t = e.timestep);
|
|
243
|
-
const n = new W.RAPIER.World(e.gravity);
|
|
244
|
-
return new ms(n, t);
|
|
245
298
|
}
|
|
246
|
-
|
|
247
|
-
|
|
299
|
+
/**
|
|
300
|
+
* このA3Objectが引数で与えられたTHREE.Object3Dを含んでいるか
|
|
301
|
+
* どうかを判定するメソッド。
|
|
302
|
+
*/
|
|
303
|
+
contains(e) {
|
|
304
|
+
let t = !1;
|
|
305
|
+
return this.object.traverse((n) => {
|
|
306
|
+
n == e && (t = !0);
|
|
307
|
+
}), t;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
class ps {
|
|
311
|
+
message;
|
|
312
|
+
dir;
|
|
313
|
+
offsetTop;
|
|
314
|
+
offsetRight;
|
|
315
|
+
offsetLeft;
|
|
316
|
+
offsetBottom;
|
|
317
|
+
constructor(e) {
|
|
318
|
+
this.message = e, this.dir = "RIGHT", this.offsetTop = { x: 0, y: 2 }, this.offsetRight = { x: 1, y: 1 }, this.offsetLeft = { x: -1, y: 1 }, this.offsetBottom = { x: 0, y: 0 };
|
|
248
319
|
}
|
|
249
320
|
}
|
|
250
321
|
class ms {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
322
|
+
firstLoc;
|
|
323
|
+
firstRot;
|
|
324
|
+
firstScale;
|
|
325
|
+
nowLoc;
|
|
326
|
+
nowRot;
|
|
327
|
+
nowScale;
|
|
328
|
+
lastLoc;
|
|
329
|
+
lastRot;
|
|
330
|
+
lastScale;
|
|
331
|
+
nowTime;
|
|
332
|
+
duration;
|
|
333
|
+
constructor(e) {
|
|
334
|
+
this.firstLoc = new D(e.location), this.firstRot = new Z(e.rot), this.firstScale = new D(e.scale), this.nowLoc = new D(e.location), this.nowRot = new Z(e.rot), this.nowScale = new D(e.scale), this.lastLoc = new D(e.location), this.lastRot = new Z(e.rot), this.lastScale = new D(e.scale), this.nowTime = 0, this.duration = 1;
|
|
255
335
|
}
|
|
256
|
-
|
|
257
|
-
|
|
336
|
+
setLoc(e, t) {
|
|
337
|
+
this.firstLoc.set(e.location), this.firstRot.set(e.rot), this.firstScale.set(e.scale), this.lastLoc.set(t), this.nowTime = 0;
|
|
258
338
|
}
|
|
259
|
-
|
|
260
|
-
|
|
339
|
+
forceSetLoc(e, t) {
|
|
340
|
+
this.firstLoc.set(e.location), this.firstRot.set(e.rot), this.firstScale.set(e.scale), this.lastLoc.set(t), this.nowTime = 1;
|
|
261
341
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
for (let n = 0; n < t; n++)
|
|
265
|
-
this.world.step();
|
|
342
|
+
setQuat(e, t) {
|
|
343
|
+
this.firstLoc.set(e.location), this.firstRot.set(e.rot), this.firstScale.set(e.scale), this.lastRot.set(t), this.nowTime = 0;
|
|
266
344
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
return "addOneself" in o && "removeOneself" in o;
|
|
270
|
-
}
|
|
271
|
-
class q {
|
|
272
|
-
scene;
|
|
273
|
-
objects;
|
|
274
|
-
static physics;
|
|
275
|
-
physicsWorld = null;
|
|
276
|
-
physicsDt = 1 / 60;
|
|
277
|
-
constructor() {
|
|
278
|
-
this.scene = new E.Scene(), this.objects = [], q.physics || (q.physics = new W());
|
|
345
|
+
forceSetQuat(e, t) {
|
|
346
|
+
this.firstLoc.set(e.location), this.firstRot.set(e.rot), this.firstScale.set(e.scale), this.lastRot.set(t), this.nowTime = 1;
|
|
279
347
|
}
|
|
280
|
-
|
|
281
|
-
this.
|
|
282
|
-
this.physicsWorld || (this.physicsWorld = await q.physics.createWorld({
|
|
283
|
-
gravity: { x: 0, y: -9.81, z: 0 },
|
|
284
|
-
timestep: this.physicsDt
|
|
285
|
-
})), e.physics || e.initPhysics(q.physics, this.physicsWorld), e.physics && this.physicsWorld.add(e.physics);
|
|
286
|
-
}));
|
|
348
|
+
setScale(e, t) {
|
|
349
|
+
this.firstLoc.set(e.location), this.firstRot.set(e.rot), this.firstScale.set(e.scale), this.lastScale.set(t), this.nowTime = 0;
|
|
287
350
|
}
|
|
288
|
-
|
|
289
|
-
this.
|
|
290
|
-
{
|
|
291
|
-
const t = this.objects.indexOf(e);
|
|
292
|
-
this.objects[t] = this.objects[this.objects.length - 1], this.objects.pop();
|
|
293
|
-
}
|
|
294
|
-
e.scene = null, e.motionControlMode === "physics" && this.physicsWorld && e.physics && this.physicsWorld.remove(e.physics);
|
|
351
|
+
forceSetScale(e, t) {
|
|
352
|
+
this.firstLoc.set(e.location), this.firstRot.set(e.rot), this.firstScale.set(e.scale), this.lastScale.set(t), this.nowTime = 1;
|
|
295
353
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
354
|
+
// cssのanimation-timing-functionみたいに
|
|
355
|
+
// 切り替えられるようにしたいね。
|
|
356
|
+
smoothstep(e) {
|
|
357
|
+
return e * e * (3 - 2 * e);
|
|
358
|
+
}
|
|
359
|
+
interpolate(e, t) {
|
|
360
|
+
this.nowTime += t, this.nowTime > this.duration && (this.nowTime = this.duration);
|
|
361
|
+
const n = this.nowTime / this.duration, s = this.smoothstep(n);
|
|
362
|
+
this.nowLoc.lerp(this.firstLoc, this.lastLoc, s), this.nowRot.slerp(this.firstRot, this.lastRot, s), this.nowScale.lerp(this.firstScale, this.lastScale, s), e.location.set(this.nowLoc), e.object.position.set(this.nowLoc.x, this.nowLoc.y, this.nowLoc.z), e.rot.set(this.nowRot), e.object.quaternion.set(this.nowRot.x, this.nowRot.y, this.nowRot.z, this.nowRot.w), e.scale.set(this.nowScale), e.object.scale.set(this.nowScale.x, this.nowScale.y, this.nowScale.z);
|
|
300
363
|
}
|
|
301
364
|
}
|
|
302
365
|
class gs extends ae {
|
|
303
366
|
}
|
|
304
|
-
class
|
|
367
|
+
class ft {
|
|
305
368
|
scene;
|
|
306
369
|
camera;
|
|
307
370
|
constructor(e) {
|
|
308
|
-
this.scene = new
|
|
371
|
+
this.scene = new J(), this.camera = e, this.scene.scene.add(this.camera.object), this.camera.setLocation(0, 0, 3);
|
|
309
372
|
}
|
|
310
373
|
replaceScene(e) {
|
|
311
374
|
this.scene.scene.remove(this.camera.object), e.scene.add(this.camera.object);
|
|
@@ -316,29 +379,29 @@ class ut {
|
|
|
316
379
|
this.scene.update(e);
|
|
317
380
|
}
|
|
318
381
|
}
|
|
319
|
-
class
|
|
382
|
+
class fe extends gs {
|
|
320
383
|
camera;
|
|
321
384
|
headLight;
|
|
322
385
|
constructor(e) {
|
|
323
|
-
super(e), this.camera = e, this.headLight = new
|
|
386
|
+
super(e), this.camera = e, this.headLight = new R.SpotLight(16777215, 1, 0, Math.PI / 3, 0, 0), this.headLight.rotation.x = 3.14 / 2, this.object.add(this.camera), this.object.add(this.headLight);
|
|
324
387
|
}
|
|
325
388
|
initObject() {
|
|
326
|
-
return new
|
|
389
|
+
return new R.Object3D();
|
|
327
390
|
}
|
|
328
391
|
getHeadLight() {
|
|
329
392
|
return this.headLight;
|
|
330
393
|
}
|
|
331
394
|
setAspect(e) {
|
|
332
|
-
|
|
395
|
+
ys(this.camera) && (this.camera.aspect = e, this.camera.updateProjectionMatrix());
|
|
333
396
|
}
|
|
334
397
|
setHeadLightEnable(e) {
|
|
335
398
|
e ? this.headLight.intensity = 1 : this.headLight.intensity = 0;
|
|
336
399
|
}
|
|
337
400
|
}
|
|
338
|
-
function
|
|
401
|
+
function ys(o) {
|
|
339
402
|
return o.isPerspectiveCamera === !0;
|
|
340
403
|
}
|
|
341
|
-
class
|
|
404
|
+
class Ts extends HTMLElement {
|
|
342
405
|
ro;
|
|
343
406
|
base;
|
|
344
407
|
renderer;
|
|
@@ -347,14 +410,14 @@ class ys extends HTMLElement {
|
|
|
347
410
|
camera3js;
|
|
348
411
|
clock;
|
|
349
412
|
constructor(e) {
|
|
350
|
-
super(), e || (e = {}), e.camera || (e.camera = new
|
|
351
|
-
const t = new
|
|
352
|
-
this.base = new
|
|
413
|
+
super(), e || (e = {}), e.camera || (e.camera = new R.PerspectiveCamera(75, 300 / 150, 0.1, 1e3)), this.camera3js = e.camera;
|
|
414
|
+
const t = new fe(e.camera);
|
|
415
|
+
this.base = new ft(t), this.scene = this.base.scene, this.camera = this.base.camera;
|
|
353
416
|
const n = {
|
|
354
417
|
antialias: e.antialias ? e.antialias : !1,
|
|
355
418
|
alpha: e.transparent ? e.transparent : !1
|
|
356
419
|
};
|
|
357
|
-
this.renderer = new
|
|
420
|
+
this.renderer = new R.WebGLRenderer(n), "opaque" in e && this.renderer.setClearAlpha(0), this.clock = new R.Clock(), this.style = "display: block; background: rgba(0,0,0,0);", this.renderer.domElement.style = "display: block; width: 100%; height: 100%; margin: 0; padding: 0;", this.appendChild(this.renderer.domElement), this.animationFrameId = requestAnimationFrame(this.renderingLoop), this.addEventListener("click", this.myMouseClickedListener);
|
|
358
421
|
}
|
|
359
422
|
connectedCallback() {
|
|
360
423
|
this.ro = new ResizeObserver(() => {
|
|
@@ -374,8 +437,27 @@ class ys extends HTMLElement {
|
|
|
374
437
|
const e = this.clock.getDelta();
|
|
375
438
|
this.base.updateScene(e), this.renderer.render(this.scene.scene, this.camera3js);
|
|
376
439
|
};
|
|
440
|
+
//----------------------------------
|
|
441
|
+
// このクラスはHTMLElementのスーパークラスだから
|
|
442
|
+
// EventTargetを継承してるので、this.dispatchEvent()で
|
|
443
|
+
// イベントを発生させられる。addEventListener()とか、
|
|
444
|
+
// 自分で作らなくてOK。
|
|
445
|
+
myMouseClickedListener = (e) => {
|
|
446
|
+
if (this.camera instanceof fe) {
|
|
447
|
+
const t = new R.Raycaster(), n = new R.Vector2(), s = e.target.getBoundingClientRect(), i = e.clientX - s.left, r = e.clientY - s.top;
|
|
448
|
+
n.x = 2 * (i / s.width) - 1, n.y = -2 * (r / s.height) + 1, t.setFromCamera(n, this.camera.camera);
|
|
449
|
+
const a = t.intersectObjects(this.scene.scene.children), c = [];
|
|
450
|
+
a.forEach((l) => {
|
|
451
|
+
for (const u of this.scene.objects)
|
|
452
|
+
if (u.contains(l.object)) {
|
|
453
|
+
c.push({ o1: l.object, o2: u });
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
}), this.dispatchEvent(new CustomEvent("click3d", { detail: { value: c } }));
|
|
457
|
+
}
|
|
458
|
+
};
|
|
377
459
|
}
|
|
378
|
-
customElements.define("a3-canvas",
|
|
460
|
+
customElements.define("a3-canvas", Ts);
|
|
379
461
|
function ws(o) {
|
|
380
462
|
return o.isPerspectiveCamera === !0;
|
|
381
463
|
}
|
|
@@ -406,13 +488,13 @@ class Rs extends HTMLElement {
|
|
|
406
488
|
offsetX = 0;
|
|
407
489
|
offsetY = 0;
|
|
408
490
|
constructor(e, t) {
|
|
409
|
-
super(), this.camera3js = new
|
|
410
|
-
const n = new
|
|
411
|
-
this.base = new
|
|
491
|
+
super(), this.camera3js = new R.PerspectiveCamera(75, e / t, 0.1, 1e3);
|
|
492
|
+
const n = new fe(this.camera3js);
|
|
493
|
+
this.base = new ft(n), this.scene = this.base.scene, this.camera = this.base.camera, this.renderer = new R.WebGLRenderer(), this.clock = new R.Clock(), this.camera3js.aspect = e / t, this.renderer.setSize(e, t), this.style = xs, document.body ? document.body.appendChild(this) : document.addEventListener("DOMContentLoaded", () => {
|
|
412
494
|
document.body.append(this);
|
|
413
495
|
}, { once: !0 });
|
|
414
496
|
const s = document.createElement("div");
|
|
415
|
-
s.textContent = "A3Window", s.style = _s, this.appendChild(s), s.addEventListener("mousedown", this.mouseDownListener), document.addEventListener("mousemove", this.mouseMoveListener), document.addEventListener("mouseup", this.mouseUpListener), this.renderer.domElement.style = `display: block; width: ${e}px; height: ${t}px; margin: 0; padding: 0;`, this.renderer.domElement.width = e, this.renderer.domElement.width = t, this.appendChild(this.renderer.domElement), this.animationFrameId = requestAnimationFrame(this.renderingLoop);
|
|
497
|
+
s.textContent = "A3Window", s.style = _s, this.appendChild(s), s.addEventListener("mousedown", this.mouseDownListener), document.addEventListener("mousemove", this.mouseMoveListener), document.addEventListener("mouseup", this.mouseUpListener), this.renderer.domElement.style = `display: block; width: ${e}px; height: ${t}px; margin: 0; padding: 0;`, this.renderer.domElement.width = e, this.renderer.domElement.width = t, this.appendChild(this.renderer.domElement), this.animationFrameId = requestAnimationFrame(this.renderingLoop), this.addEventListener("click", this.myMouseClickedListener);
|
|
416
498
|
}
|
|
417
499
|
connectedCallback() {
|
|
418
500
|
this.ro = new ResizeObserver(() => {
|
|
@@ -441,31 +523,50 @@ class Rs extends HTMLElement {
|
|
|
441
523
|
const e = this.clock.getDelta();
|
|
442
524
|
this.scene && (this.scene.update(e), this.renderer.render(this.scene.scene, this.camera3js));
|
|
443
525
|
};
|
|
526
|
+
//----------------------------------
|
|
527
|
+
// このクラスはHTMLElementのスーパークラスだから
|
|
528
|
+
// EventTargetを継承してるので、this.dispatchEvent()で
|
|
529
|
+
// イベントを発生させられる。addEventListener()とか、
|
|
530
|
+
// 自分で作らなくてOK。
|
|
531
|
+
myMouseClickedListener = (e) => {
|
|
532
|
+
if (this.camera instanceof fe) {
|
|
533
|
+
const t = new R.Raycaster(), n = new R.Vector2(), s = e.target.getBoundingClientRect(), i = e.clientX - s.left, r = e.clientY - s.top;
|
|
534
|
+
n.x = 2 * (i / s.width) - 1, n.y = -2 * (r / s.height) + 1, t.setFromCamera(n, this.camera.camera);
|
|
535
|
+
const a = t.intersectObjects(this.scene.scene.children), c = [];
|
|
536
|
+
a.forEach((l) => {
|
|
537
|
+
for (const u of this.scene.objects)
|
|
538
|
+
if (u.contains(l.object)) {
|
|
539
|
+
c.push({ o1: l.object, o2: u });
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
}), this.dispatchEvent(new CustomEvent("click3d", { detail: { value: c } }));
|
|
543
|
+
}
|
|
544
|
+
};
|
|
444
545
|
}
|
|
445
546
|
customElements.define("a3-window", Rs);
|
|
446
547
|
class kn extends ae {
|
|
447
548
|
constructor(e) {
|
|
448
|
-
super(), e && e.physics ? this.
|
|
549
|
+
super(), e && e.physics ? this.setControlMode("physics") : this.setControlMode("user");
|
|
449
550
|
}
|
|
450
551
|
initObject() {
|
|
451
|
-
const e = new
|
|
452
|
-
return new
|
|
552
|
+
const e = new R.BoxGeometry(), t = new R.MeshStandardMaterial({ color: 65280 });
|
|
553
|
+
return new R.Mesh(e, t);
|
|
453
554
|
}
|
|
454
555
|
initPhysics(e, t) {
|
|
455
|
-
this.physics = new
|
|
556
|
+
this.physics = new bs(this);
|
|
456
557
|
}
|
|
457
558
|
update(e) {
|
|
458
|
-
this.
|
|
559
|
+
this.controlMode === "physics" ? super.update(e) : this.controlMode === "interpolated" ? super.update(e) : (this.object.rotation.x += e, this.object.rotation.y += e, this.object.rotation.z += e);
|
|
459
560
|
}
|
|
460
561
|
}
|
|
461
|
-
class
|
|
562
|
+
class bs {
|
|
462
563
|
object;
|
|
463
564
|
bodyDesc;
|
|
464
565
|
body = null;
|
|
465
566
|
colliderDesc;
|
|
466
567
|
collider = null;
|
|
467
568
|
constructor(e) {
|
|
468
|
-
this.object = e, this.bodyDesc =
|
|
569
|
+
this.object = e, this.bodyDesc = V.RAPIER.RigidBodyDesc.dynamic(), this.bodyDesc.setTranslation(e.location.x, e.location.y, e.location.z), this.colliderDesc = V.RAPIER.ColliderDesc.cuboid(0.5, 0.5, 0.5), this.colliderDesc.setRestitution(0.3).setFriction(0.6);
|
|
469
570
|
}
|
|
470
571
|
synchronize(e) {
|
|
471
572
|
if (this.body) {
|
|
@@ -481,16 +582,16 @@ class Es {
|
|
|
481
582
|
removeOneself(e) {
|
|
482
583
|
this.body && e.world.removeRigidBody(this.body), this.collider && e.world.removeCollider(this.collider, !1);
|
|
483
584
|
}
|
|
484
|
-
|
|
585
|
+
forceSetLoc(e) {
|
|
485
586
|
this.body && this.body.setTranslation(e, !0);
|
|
486
587
|
}
|
|
487
|
-
|
|
588
|
+
forceSetQuat(e) {
|
|
488
589
|
this.body && this.body.setRotation(e, !0);
|
|
489
590
|
}
|
|
490
|
-
|
|
591
|
+
forceSetScale(e) {
|
|
491
592
|
}
|
|
492
593
|
}
|
|
493
|
-
class
|
|
594
|
+
class Es {
|
|
494
595
|
/**
|
|
495
596
|
* Constructs a new font.
|
|
496
597
|
*
|
|
@@ -537,11 +638,11 @@ function As(o, e, t, n, s) {
|
|
|
537
638
|
console.error('THREE.Font: character "' + o + '" does not exists in font family ' + s.familyName + ".");
|
|
538
639
|
return;
|
|
539
640
|
}
|
|
540
|
-
const r = new
|
|
641
|
+
const r = new Ct();
|
|
541
642
|
let a, c, l, u, h, f, d, g;
|
|
542
643
|
if (i.o) {
|
|
543
644
|
const m = i._cachedOutline || (i._cachedOutline = i.o.split(" "));
|
|
544
|
-
for (let p = 0,
|
|
645
|
+
for (let p = 0, y = m.length; p < y; )
|
|
545
646
|
switch (m[p++]) {
|
|
546
647
|
case "m":
|
|
547
648
|
a = m[p++] * e + t, c = m[p++] * e + n, r.moveTo(a, c);
|
|
@@ -580,7 +681,7 @@ class Ss extends It {
|
|
|
580
681
|
function dt(o) {
|
|
581
682
|
return typeof o == "string";
|
|
582
683
|
}
|
|
583
|
-
var
|
|
684
|
+
var v = Uint8Array, Q = Uint16Array, Ms = Int32Array, pt = new v([
|
|
584
685
|
0,
|
|
585
686
|
0,
|
|
586
687
|
0,
|
|
@@ -615,7 +716,7 @@ var C = Uint8Array, Q = Uint16Array, Ms = Int32Array, pt = new C([
|
|
|
615
716
|
0,
|
|
616
717
|
/* impossible */
|
|
617
718
|
0
|
|
618
|
-
]), mt = new
|
|
719
|
+
]), mt = new v([
|
|
619
720
|
0,
|
|
620
721
|
0,
|
|
621
722
|
0,
|
|
@@ -649,19 +750,19 @@ var C = Uint8Array, Q = Uint16Array, Ms = Int32Array, pt = new C([
|
|
|
649
750
|
/* unused */
|
|
650
751
|
0,
|
|
651
752
|
0
|
|
652
|
-
]),
|
|
753
|
+
]), vs = new v([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), gt = function(o, e) {
|
|
653
754
|
for (var t = new Q(31), n = 0; n < 31; ++n)
|
|
654
755
|
t[n] = e += 1 << o[n - 1];
|
|
655
756
|
for (var s = new Ms(t[30]), n = 1; n < 30; ++n)
|
|
656
757
|
for (var i = t[n]; i < t[n + 1]; ++i)
|
|
657
758
|
s[i] = i - t[n] << 5 | n;
|
|
658
759
|
return { b: t, r: s };
|
|
659
|
-
},
|
|
660
|
-
|
|
661
|
-
var Is = gt(mt, 0), ks = Is.b,
|
|
662
|
-
for (var
|
|
663
|
-
var z = (
|
|
664
|
-
z = (z & 52428) >> 2 | (z & 13107) << 2, z = (z & 61680) >> 4 | (z & 3855) << 4,
|
|
760
|
+
}, yt = gt(pt, 2), Tt = yt.b, Cs = yt.r;
|
|
761
|
+
Tt[28] = 258, Cs[258] = 28;
|
|
762
|
+
var Is = gt(mt, 0), ks = Is.b, ve = new Q(32768);
|
|
763
|
+
for (var b = 0; b < 32768; ++b) {
|
|
764
|
+
var z = (b & 43690) >> 1 | (b & 21845) << 1;
|
|
765
|
+
z = (z & 52428) >> 2 | (z & 13107) << 2, z = (z & 61680) >> 4 | (z & 3855) << 4, ve[b] = ((z & 65280) >> 8 | (z & 255) << 8) >> 1;
|
|
665
766
|
}
|
|
666
767
|
var oe = (function(o, e, t) {
|
|
667
768
|
for (var n = o.length, s = 0, i = new Q(e); s < n; ++s)
|
|
@@ -676,37 +777,37 @@ var oe = (function(o, e, t) {
|
|
|
676
777
|
for (s = 0; s < n; ++s)
|
|
677
778
|
if (o[s])
|
|
678
779
|
for (var l = s << 4 | o[s], u = e - o[s], h = r[o[s] - 1]++ << u, f = h | (1 << u) - 1; h <= f; ++h)
|
|
679
|
-
a[
|
|
780
|
+
a[ve[h] >> c] = l;
|
|
680
781
|
} else
|
|
681
782
|
for (a = new Q(n), s = 0; s < n; ++s)
|
|
682
|
-
o[s] && (a[s] =
|
|
783
|
+
o[s] && (a[s] = ve[r[o[s] - 1]++] >> 15 - o[s]);
|
|
683
784
|
return a;
|
|
684
|
-
}), ce = new
|
|
685
|
-
for (var
|
|
686
|
-
ce[
|
|
687
|
-
for (var
|
|
688
|
-
ce[
|
|
689
|
-
for (var
|
|
690
|
-
ce[
|
|
691
|
-
for (var
|
|
692
|
-
ce[
|
|
693
|
-
var wt = new
|
|
694
|
-
for (var
|
|
695
|
-
wt[
|
|
785
|
+
}), ce = new v(288);
|
|
786
|
+
for (var b = 0; b < 144; ++b)
|
|
787
|
+
ce[b] = 8;
|
|
788
|
+
for (var b = 144; b < 256; ++b)
|
|
789
|
+
ce[b] = 9;
|
|
790
|
+
for (var b = 256; b < 280; ++b)
|
|
791
|
+
ce[b] = 7;
|
|
792
|
+
for (var b = 280; b < 288; ++b)
|
|
793
|
+
ce[b] = 8;
|
|
794
|
+
var wt = new v(32);
|
|
795
|
+
for (var b = 0; b < 32; ++b)
|
|
796
|
+
wt[b] = 5;
|
|
696
797
|
var Ns = /* @__PURE__ */ oe(ce, 9, 1), Ds = /* @__PURE__ */ oe(wt, 5, 1), Te = function(o) {
|
|
697
798
|
for (var e = o[0], t = 1; t < o.length; ++t)
|
|
698
799
|
o[t] > e && (e = o[t]);
|
|
699
800
|
return e;
|
|
700
|
-
},
|
|
801
|
+
}, P = function(o, e, t) {
|
|
701
802
|
var n = e / 8 | 0;
|
|
702
803
|
return (o[n] | o[n + 1] << 8) >> (e & 7) & t;
|
|
703
|
-
},
|
|
804
|
+
}, we = function(o, e) {
|
|
704
805
|
var t = e / 8 | 0;
|
|
705
806
|
return (o[t] | o[t + 1] << 8 | o[t + 2] << 16) >> (e & 7);
|
|
706
807
|
}, Ps = function(o) {
|
|
707
808
|
return (o + 7) / 8 | 0;
|
|
708
|
-
},
|
|
709
|
-
return (e == null || e < 0) && (e = 0), (t == null || t > o.length) && (t = o.length), new
|
|
809
|
+
}, De = function(o, e, t) {
|
|
810
|
+
return (e == null || e < 0) && (e = 0), (t == null || t > o.length) && (t = o.length), new v(o.subarray(e, t));
|
|
710
811
|
}, Os = [
|
|
711
812
|
"unexpected EOF",
|
|
712
813
|
"invalid block type",
|
|
@@ -731,108 +832,108 @@ var Ns = /* @__PURE__ */ oe(ce, 9, 1), Ds = /* @__PURE__ */ oe(wt, 5, 1), Te = f
|
|
|
731
832
|
}, Fs = function(o, e, t, n) {
|
|
732
833
|
var s = o.length, i = n ? n.length : 0;
|
|
733
834
|
if (!s || e.f && !e.l)
|
|
734
|
-
return t || new
|
|
835
|
+
return t || new v(0);
|
|
735
836
|
var r = !t, a = r || e.i != 2, c = e.i;
|
|
736
|
-
r && (t = new
|
|
737
|
-
var l = function(
|
|
738
|
-
var
|
|
739
|
-
if (
|
|
740
|
-
var
|
|
741
|
-
|
|
742
|
-
}
|
|
743
|
-
}, u = e.f || 0, h = e.p || 0, f = e.b || 0, d = e.l, g = e.d, m = e.m, p = e.n,
|
|
837
|
+
r && (t = new v(s * 3));
|
|
838
|
+
var l = function(Be) {
|
|
839
|
+
var ze = t.length;
|
|
840
|
+
if (Be > ze) {
|
|
841
|
+
var je = new v(Math.max(ze * 2, Be));
|
|
842
|
+
je.set(t), t = je;
|
|
843
|
+
}
|
|
844
|
+
}, u = e.f || 0, h = e.p || 0, f = e.b || 0, d = e.l, g = e.d, m = e.m, p = e.n, y = s * 8;
|
|
744
845
|
do {
|
|
745
846
|
if (!d) {
|
|
746
|
-
u =
|
|
747
|
-
var _ =
|
|
847
|
+
u = P(o, h, 1);
|
|
848
|
+
var _ = P(o, h + 1, 3);
|
|
748
849
|
if (h += 3, _)
|
|
749
850
|
if (_ == 1)
|
|
750
851
|
d = Ns, g = Ds, m = 9, p = 5;
|
|
751
852
|
else if (_ == 2) {
|
|
752
|
-
var L =
|
|
853
|
+
var L = P(o, h, 31) + 257, A = P(o, h + 10, 15) + 4, C = L + P(o, h + 5, 31) + 1;
|
|
753
854
|
h += 14;
|
|
754
|
-
for (var M = new C
|
|
755
|
-
I[
|
|
855
|
+
for (var M = new v(C), I = new v(19), S = 0; S < A; ++S)
|
|
856
|
+
I[vs[S]] = P(o, h + S * 3, 7);
|
|
756
857
|
h += A * 3;
|
|
757
|
-
for (var
|
|
758
|
-
var
|
|
759
|
-
h +=
|
|
760
|
-
var
|
|
761
|
-
if (
|
|
762
|
-
M[S++] =
|
|
858
|
+
for (var Pe = Te(I), Lt = (1 << Pe) - 1, At = oe(I, Pe, 1), S = 0; S < C; ) {
|
|
859
|
+
var Oe = At[P(o, h, Lt)];
|
|
860
|
+
h += Oe & 15;
|
|
861
|
+
var T = Oe >> 4;
|
|
862
|
+
if (T < 16)
|
|
863
|
+
M[S++] = T;
|
|
763
864
|
else {
|
|
764
865
|
var Y = 0, le = 0;
|
|
765
|
-
for (
|
|
866
|
+
for (T == 16 ? (le = 3 + P(o, h, 3), h += 2, Y = M[S - 1]) : T == 17 ? (le = 3 + P(o, h, 7), h += 3) : T == 18 && (le = 11 + P(o, h, 127), h += 7); le--; )
|
|
766
867
|
M[S++] = Y;
|
|
767
868
|
}
|
|
768
869
|
}
|
|
769
|
-
var
|
|
770
|
-
m = Te(
|
|
870
|
+
var Fe = M.subarray(0, L), B = M.subarray(L);
|
|
871
|
+
m = Te(Fe), p = Te(B), d = oe(Fe, m, 1), g = oe(B, p, 1);
|
|
771
872
|
} else
|
|
772
873
|
N(1);
|
|
773
874
|
else {
|
|
774
|
-
var
|
|
775
|
-
if (
|
|
875
|
+
var T = Ps(h) + 4, w = o[T - 4] | o[T - 3] << 8, E = T + w;
|
|
876
|
+
if (E > s) {
|
|
776
877
|
c && N(0);
|
|
777
878
|
break;
|
|
778
879
|
}
|
|
779
|
-
a && l(f + w), t.set(o.subarray(
|
|
880
|
+
a && l(f + w), t.set(o.subarray(T, E), f), e.b = f += w, e.p = h = E * 8, e.f = u;
|
|
780
881
|
continue;
|
|
781
882
|
}
|
|
782
|
-
if (h >
|
|
883
|
+
if (h > y) {
|
|
783
884
|
c && N(0);
|
|
784
885
|
break;
|
|
785
886
|
}
|
|
786
887
|
}
|
|
787
888
|
a && l(f + 131072);
|
|
788
|
-
for (var St = (1 << m) - 1, Mt = (1 << p) - 1,
|
|
789
|
-
var Y = d[
|
|
790
|
-
if (h += Y & 15, h >
|
|
889
|
+
for (var St = (1 << m) - 1, Mt = (1 << p) - 1, de = h; ; de = h) {
|
|
890
|
+
var Y = d[we(o, h) & St], $ = Y >> 4;
|
|
891
|
+
if (h += Y & 15, h > y) {
|
|
791
892
|
c && N(0);
|
|
792
893
|
break;
|
|
793
894
|
}
|
|
794
895
|
if (Y || N(2), $ < 256)
|
|
795
896
|
t[f++] = $;
|
|
796
897
|
else if ($ == 256) {
|
|
797
|
-
|
|
898
|
+
de = h, d = null;
|
|
798
899
|
break;
|
|
799
900
|
} else {
|
|
800
|
-
var
|
|
901
|
+
var He = $ - 254;
|
|
801
902
|
if ($ > 264) {
|
|
802
|
-
var S = $ - 257,
|
|
803
|
-
|
|
903
|
+
var S = $ - 257, te = pt[S];
|
|
904
|
+
He = P(o, h, (1 << te) - 1) + Tt[S], h += te;
|
|
804
905
|
}
|
|
805
|
-
var
|
|
806
|
-
|
|
807
|
-
var B = ks[
|
|
808
|
-
if (
|
|
809
|
-
var
|
|
810
|
-
B +=
|
|
906
|
+
var pe = g[we(o, h) & Mt], me = pe >> 4;
|
|
907
|
+
pe || N(3), h += pe & 15;
|
|
908
|
+
var B = ks[me];
|
|
909
|
+
if (me > 3) {
|
|
910
|
+
var te = mt[me];
|
|
911
|
+
B += we(o, h) & (1 << te) - 1, h += te;
|
|
811
912
|
}
|
|
812
|
-
if (h >
|
|
913
|
+
if (h > y) {
|
|
813
914
|
c && N(0);
|
|
814
915
|
break;
|
|
815
916
|
}
|
|
816
917
|
a && l(f + 131072);
|
|
817
|
-
var
|
|
918
|
+
var Ue = f + He;
|
|
818
919
|
if (f < B) {
|
|
819
|
-
var
|
|
820
|
-
for (
|
|
821
|
-
t[f] = n[
|
|
920
|
+
var Ge = i - B, vt = Math.min(B, Ue);
|
|
921
|
+
for (Ge + f < 0 && N(3); f < vt; ++f)
|
|
922
|
+
t[f] = n[Ge + f];
|
|
822
923
|
}
|
|
823
|
-
for (; f <
|
|
924
|
+
for (; f < Ue; ++f)
|
|
824
925
|
t[f] = t[f - B];
|
|
825
926
|
}
|
|
826
927
|
}
|
|
827
|
-
e.l = d, e.p =
|
|
928
|
+
e.l = d, e.p = de, e.b = f, e.f = u, d && (u = 1, e.m = m, e.d = g, e.n = p);
|
|
828
929
|
} while (!u);
|
|
829
|
-
return f != t.length && r ?
|
|
830
|
-
}, Hs = /* @__PURE__ */ new
|
|
930
|
+
return f != t.length && r ? De(t, 0, f) : t.subarray(0, f);
|
|
931
|
+
}, Hs = /* @__PURE__ */ new v(0), H = function(o, e) {
|
|
831
932
|
return o[e] | o[e + 1] << 8;
|
|
832
|
-
},
|
|
933
|
+
}, O = function(o, e) {
|
|
833
934
|
return (o[e] | o[e + 1] << 8 | o[e + 2] << 16 | o[e + 3] << 24) >>> 0;
|
|
834
|
-
},
|
|
835
|
-
return
|
|
935
|
+
}, xe = function(o, e) {
|
|
936
|
+
return O(o, e) + O(o, e + 4) * 4294967296;
|
|
836
937
|
};
|
|
837
938
|
function Us(o, e) {
|
|
838
939
|
return Fs(o, { i: 2 }, e && e.out, e && e.dictionary);
|
|
@@ -846,7 +947,7 @@ var Bs = function(o) {
|
|
|
846
947
|
for (var e = "", t = 0; ; ) {
|
|
847
948
|
var n = o[t++], s = (n > 127) + (n > 223) + (n > 239);
|
|
848
949
|
if (t + s > o.length)
|
|
849
|
-
return { s: e, r:
|
|
950
|
+
return { s: e, r: De(o, t - 1) };
|
|
850
951
|
s ? s == 3 ? (n = ((n & 15) << 18 | (o[t++] & 63) << 12 | (o[t++] & 63) << 6 | o[t++] & 63) - 65536, e += String.fromCharCode(55296 | n >> 10, 56320 | n & 1023)) : s & 1 ? e += String.fromCharCode((n & 31) << 6 | o[t++] & 63) : e += String.fromCharCode((n & 15) << 12 | (o[t++] & 63) << 6 | o[t++] & 63) : e += String.fromCharCode(n);
|
|
851
952
|
}
|
|
852
953
|
};
|
|
@@ -865,55 +966,55 @@ function xt(o, e) {
|
|
|
865
966
|
var zs = function(o, e) {
|
|
866
967
|
return e + 30 + H(o, e + 26) + H(o, e + 28);
|
|
867
968
|
}, js = function(o, e, t) {
|
|
868
|
-
var n = H(o, e + 28), s = xt(o.subarray(e + 46, e + 46 + n), !(H(o, e + 8) & 2048)), i = e + 46 + n, r =
|
|
969
|
+
var n = H(o, e + 28), s = xt(o.subarray(e + 46, e + 46 + n), !(H(o, e + 8) & 2048)), i = e + 46 + n, r = O(o, e + 20), a = t && r == 4294967295 ? Ks(o, i) : [r, O(o, e + 24), O(o, e + 42)], c = a[0], l = a[1], u = a[2];
|
|
869
970
|
return [H(o, e + 10), c, l, s, i + H(o, e + 30) + H(o, e + 32), u];
|
|
870
971
|
}, Ks = function(o, e) {
|
|
871
972
|
for (; H(o, e) != 1; e += 4 + H(o, e + 2))
|
|
872
973
|
;
|
|
873
|
-
return [
|
|
974
|
+
return [xe(o, e + 12), xe(o, e + 4), xe(o, e + 20)];
|
|
874
975
|
};
|
|
875
976
|
function Xs(o, e) {
|
|
876
|
-
for (var t = {}, n = o.length - 22;
|
|
977
|
+
for (var t = {}, n = o.length - 22; O(o, n) != 101010256; --n)
|
|
877
978
|
(!n || o.length - n > 65558) && N(13);
|
|
878
979
|
var s = H(o, n + 8);
|
|
879
980
|
if (!s)
|
|
880
981
|
return {};
|
|
881
|
-
var i =
|
|
982
|
+
var i = O(o, n + 16), r = i == 4294967295 || s == 65535;
|
|
882
983
|
if (r) {
|
|
883
|
-
var a =
|
|
884
|
-
r =
|
|
984
|
+
var a = O(o, n - 12);
|
|
985
|
+
r = O(o, a) == 101075792, r && (s = O(o, a + 32), i = O(o, a + 48));
|
|
885
986
|
}
|
|
886
987
|
for (var c = 0; c < s; ++c) {
|
|
887
988
|
var l = js(o, i, r), u = l[0], h = l[1], f = l[2], d = l[3], g = l[4], m = l[5], p = zs(o, m);
|
|
888
|
-
i = g, u ? u == 8 ? t[d] = Us(o.subarray(p, p + h), { out: new
|
|
989
|
+
i = g, u ? u == 8 ? t[d] = Us(o.subarray(p, p + h), { out: new v(f) }) : N(14, "unknown compression type " + u) : t[d] = De(o, p, p + h);
|
|
889
990
|
}
|
|
890
991
|
return t;
|
|
891
992
|
}
|
|
892
|
-
let
|
|
993
|
+
let Ie = null;
|
|
893
994
|
async function Nn(o) {
|
|
894
|
-
const e = o.substring(0, o.length - 4), t = new
|
|
995
|
+
const e = o.substring(0, o.length - 4), t = new R.FileLoader();
|
|
895
996
|
t.setResponseType("arraybuffer");
|
|
896
997
|
const n = await t.loadAsync(o), s = Xs(new Uint8Array(n)), i = xt(new Uint8Array(s[e].buffer));
|
|
897
|
-
|
|
998
|
+
Ie = new Es(JSON.parse(i));
|
|
898
999
|
}
|
|
899
1000
|
class Dn extends ae {
|
|
900
1001
|
initObject(e) {
|
|
901
1002
|
let t;
|
|
902
|
-
if (dt(e) ? t = e : t = "ERROR",
|
|
903
|
-
const n = new
|
|
904
|
-
return new
|
|
1003
|
+
if (dt(e) ? t = e : t = "ERROR", Ie == null) {
|
|
1004
|
+
const n = new R.BoxGeometry(), s = new R.MeshStandardMaterial({ color: 16711680 });
|
|
1005
|
+
return new R.Mesh(n, s);
|
|
905
1006
|
} else {
|
|
906
|
-
const n = { font:
|
|
1007
|
+
const n = { font: Ie, size: 1, depth: 0.5, curveSegments: 12 }, s = new Ss(t, n);
|
|
907
1008
|
s.center();
|
|
908
|
-
const i = new
|
|
909
|
-
return new
|
|
1009
|
+
const i = new R.MeshStandardMaterial({ color: 65280 });
|
|
1010
|
+
return new R.Mesh(s, i);
|
|
910
1011
|
}
|
|
911
1012
|
}
|
|
912
1013
|
}
|
|
913
|
-
function
|
|
1014
|
+
function $e(o, e) {
|
|
914
1015
|
if (e === kt)
|
|
915
1016
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), o;
|
|
916
|
-
if (e ===
|
|
1017
|
+
if (e === Le || e === et) {
|
|
917
1018
|
let t = o.getIndex();
|
|
918
1019
|
if (t === null) {
|
|
919
1020
|
const r = [], a = o.getAttribute("position");
|
|
@@ -925,7 +1026,7 @@ function Ye(o, e) {
|
|
|
925
1026
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), o;
|
|
926
1027
|
}
|
|
927
1028
|
const n = t.count - 2, s = [];
|
|
928
|
-
if (e ===
|
|
1029
|
+
if (e === Le)
|
|
929
1030
|
for (let r = 1; r <= n; r++)
|
|
930
1031
|
s.push(t.getX(0)), s.push(t.getX(r)), s.push(t.getX(r + 1));
|
|
931
1032
|
else
|
|
@@ -937,7 +1038,7 @@ function Ye(o, e) {
|
|
|
937
1038
|
} else
|
|
938
1039
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), o;
|
|
939
1040
|
}
|
|
940
|
-
class
|
|
1041
|
+
class Ws extends tt {
|
|
941
1042
|
/**
|
|
942
1043
|
* Constructs a new glTF loader.
|
|
943
1044
|
*
|
|
@@ -945,7 +1046,7 @@ class Vs extends et {
|
|
|
945
1046
|
*/
|
|
946
1047
|
constructor(e) {
|
|
947
1048
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
948
|
-
return new
|
|
1049
|
+
return new Js(t);
|
|
949
1050
|
}), this.register(function(t) {
|
|
950
1051
|
return new Qs(t);
|
|
951
1052
|
}), this.register(function(t) {
|
|
@@ -963,7 +1064,7 @@ class Vs extends et {
|
|
|
963
1064
|
}), this.register(function(t) {
|
|
964
1065
|
return new nn(t);
|
|
965
1066
|
}), this.register(function(t) {
|
|
966
|
-
return new
|
|
1067
|
+
return new qs(t);
|
|
967
1068
|
}), this.register(function(t) {
|
|
968
1069
|
return new rn(t);
|
|
969
1070
|
}), this.register(function(t) {
|
|
@@ -995,10 +1096,10 @@ class Vs extends et {
|
|
|
995
1096
|
if (this.resourcePath !== "")
|
|
996
1097
|
r = this.resourcePath;
|
|
997
1098
|
else if (this.path !== "") {
|
|
998
|
-
const l =
|
|
999
|
-
r =
|
|
1099
|
+
const l = ie.extractUrlBase(e);
|
|
1100
|
+
r = ie.resolveURL(l, this.path);
|
|
1000
1101
|
} else
|
|
1001
|
-
r =
|
|
1102
|
+
r = ie.extractUrlBase(e);
|
|
1002
1103
|
this.manager.itemStart(e);
|
|
1003
1104
|
const a = function(l) {
|
|
1004
1105
|
s ? s(l) : console.error(l), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
@@ -1143,7 +1244,7 @@ class Vs extends et {
|
|
|
1143
1244
|
});
|
|
1144
1245
|
}
|
|
1145
1246
|
}
|
|
1146
|
-
function
|
|
1247
|
+
function Vs() {
|
|
1147
1248
|
let o = {};
|
|
1148
1249
|
return {
|
|
1149
1250
|
get: function(e) {
|
|
@@ -1217,7 +1318,7 @@ class Ys {
|
|
|
1217
1318
|
default:
|
|
1218
1319
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type);
|
|
1219
1320
|
}
|
|
1220
|
-
return l.position.set(0, 0, 0),
|
|
1321
|
+
return l.position.set(0, 0, 0), F(l, c), c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), s = Promise.resolve(l), t.cache.add(n, s), s;
|
|
1221
1322
|
}
|
|
1222
1323
|
getDependency(e, t) {
|
|
1223
1324
|
if (e === "light")
|
|
@@ -1235,7 +1336,7 @@ class $s {
|
|
|
1235
1336
|
this.name = x.KHR_MATERIALS_UNLIT;
|
|
1236
1337
|
}
|
|
1237
1338
|
getMaterialType() {
|
|
1238
|
-
return
|
|
1339
|
+
return ne;
|
|
1239
1340
|
}
|
|
1240
1341
|
extendParams(e, t, n) {
|
|
1241
1342
|
const s = [];
|
|
@@ -1251,7 +1352,7 @@ class $s {
|
|
|
1251
1352
|
return Promise.all(s);
|
|
1252
1353
|
}
|
|
1253
1354
|
}
|
|
1254
|
-
class
|
|
1355
|
+
class qs {
|
|
1255
1356
|
constructor(e) {
|
|
1256
1357
|
this.parser = e, this.name = x.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
1257
1358
|
}
|
|
@@ -1263,7 +1364,7 @@ class Js {
|
|
|
1263
1364
|
return i !== void 0 && (t.emissiveIntensity = i), Promise.resolve();
|
|
1264
1365
|
}
|
|
1265
1366
|
}
|
|
1266
|
-
class
|
|
1367
|
+
class Js {
|
|
1267
1368
|
constructor(e) {
|
|
1268
1369
|
this.parser = e, this.name = x.KHR_MATERIALS_CLEARCOAT;
|
|
1269
1370
|
}
|
|
@@ -1278,7 +1379,7 @@ class qs {
|
|
|
1278
1379
|
const i = [], r = s.extensions[this.name];
|
|
1279
1380
|
if (r.clearcoatFactor !== void 0 && (t.clearcoat = r.clearcoatFactor), r.clearcoatTexture !== void 0 && i.push(n.assignTexture(t, "clearcoatMap", r.clearcoatTexture)), r.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = r.clearcoatRoughnessFactor), r.clearcoatRoughnessTexture !== void 0 && i.push(n.assignTexture(t, "clearcoatRoughnessMap", r.clearcoatRoughnessTexture)), r.clearcoatNormalTexture !== void 0 && (i.push(n.assignTexture(t, "clearcoatNormalMap", r.clearcoatNormalTexture)), r.clearcoatNormalTexture.scale !== void 0)) {
|
|
1280
1381
|
const a = r.clearcoatNormalTexture.scale;
|
|
1281
|
-
t.clearcoatNormalScale = new
|
|
1382
|
+
t.clearcoatNormalScale = new st(a, a);
|
|
1282
1383
|
}
|
|
1283
1384
|
return Promise.all(i);
|
|
1284
1385
|
}
|
|
@@ -1532,25 +1633,25 @@ class fn {
|
|
|
1532
1633
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((l) => {
|
|
1533
1634
|
const u = l.pop(), h = u.isGroup ? u.children : [u], f = l[0].count, d = [];
|
|
1534
1635
|
for (const g of h) {
|
|
1535
|
-
const m = new ue(), p = new
|
|
1636
|
+
const m = new ue(), p = new q(), y = new nt(), _ = new q(1, 1, 1), T = new Ot(g.geometry, g.material, f);
|
|
1536
1637
|
for (let w = 0; w < f; w++)
|
|
1537
|
-
c.TRANSLATION && p.fromBufferAttribute(c.TRANSLATION, w), c.ROTATION &&
|
|
1638
|
+
c.TRANSLATION && p.fromBufferAttribute(c.TRANSLATION, w), c.ROTATION && y.fromBufferAttribute(c.ROTATION, w), c.SCALE && _.fromBufferAttribute(c.SCALE, w), T.setMatrixAt(w, m.compose(p, y, _));
|
|
1538
1639
|
for (const w in c)
|
|
1539
1640
|
if (w === "_COLOR_0") {
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1641
|
+
const E = c[w];
|
|
1642
|
+
T.instanceColor = new Ft(E.array, E.itemSize, E.normalized);
|
|
1542
1643
|
} else w !== "TRANSLATION" && w !== "ROTATION" && w !== "SCALE" && g.geometry.setAttribute(w, c[w]);
|
|
1543
|
-
|
|
1644
|
+
it.prototype.copy.call(T, g), this.parser.assignFinalMaterial(T), d.push(T);
|
|
1544
1645
|
}
|
|
1545
1646
|
return u.isGroup ? (u.clear(), u.add(...d), u) : d[0];
|
|
1546
1647
|
}));
|
|
1547
1648
|
}
|
|
1548
1649
|
}
|
|
1549
|
-
const _t = "glTF",
|
|
1650
|
+
const _t = "glTF", se = 12, qe = { JSON: 1313821514, BIN: 5130562 };
|
|
1550
1651
|
class dn {
|
|
1551
1652
|
constructor(e) {
|
|
1552
1653
|
this.name = x.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
1553
|
-
const t = new DataView(e, 0,
|
|
1654
|
+
const t = new DataView(e, 0, se), n = new TextDecoder();
|
|
1554
1655
|
if (this.header = {
|
|
1555
1656
|
magic: n.decode(new Uint8Array(e.slice(0, 4))),
|
|
1556
1657
|
version: t.getUint32(4, !0),
|
|
@@ -1559,17 +1660,17 @@ class dn {
|
|
|
1559
1660
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
1560
1661
|
if (this.header.version < 2)
|
|
1561
1662
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
1562
|
-
const s = this.header.length -
|
|
1663
|
+
const s = this.header.length - se, i = new DataView(e, se);
|
|
1563
1664
|
let r = 0;
|
|
1564
1665
|
for (; r < s; ) {
|
|
1565
1666
|
const a = i.getUint32(r, !0);
|
|
1566
1667
|
r += 4;
|
|
1567
1668
|
const c = i.getUint32(r, !0);
|
|
1568
|
-
if (r += 4, c ===
|
|
1569
|
-
const l = new Uint8Array(e,
|
|
1669
|
+
if (r += 4, c === qe.JSON) {
|
|
1670
|
+
const l = new Uint8Array(e, se + r, a);
|
|
1570
1671
|
this.content = n.decode(l);
|
|
1571
|
-
} else if (c ===
|
|
1572
|
-
const l =
|
|
1672
|
+
} else if (c === qe.BIN) {
|
|
1673
|
+
const l = se + r;
|
|
1573
1674
|
this.body = e.slice(l, l + a);
|
|
1574
1675
|
}
|
|
1575
1676
|
r += a;
|
|
@@ -1587,13 +1688,13 @@ class pn {
|
|
|
1587
1688
|
decodePrimitive(e, t) {
|
|
1588
1689
|
const n = this.json, s = this.dracoLoader, i = e.extensions[this.name].bufferView, r = e.extensions[this.name].attributes, a = {}, c = {}, l = {};
|
|
1589
1690
|
for (const u in r) {
|
|
1590
|
-
const h =
|
|
1691
|
+
const h = ke[u] || u.toLowerCase();
|
|
1591
1692
|
a[h] = r[u];
|
|
1592
1693
|
}
|
|
1593
1694
|
for (const u in e.attributes) {
|
|
1594
|
-
const h =
|
|
1695
|
+
const h = ke[u] || u.toLowerCase();
|
|
1595
1696
|
if (r[u] !== void 0) {
|
|
1596
|
-
const f = n.accessors[e.attributes[u]], d =
|
|
1697
|
+
const f = n.accessors[e.attributes[u]], d = ee[f.componentType];
|
|
1597
1698
|
l[h] = d.name, c[h] = f.normalized === !0;
|
|
1598
1699
|
}
|
|
1599
1700
|
}
|
|
@@ -1634,19 +1735,19 @@ class Rt extends ls {
|
|
|
1634
1735
|
return t;
|
|
1635
1736
|
}
|
|
1636
1737
|
interpolate_(e, t, n, s) {
|
|
1637
|
-
const i = this.resultBuffer, r = this.sampleValues, a = this.valueSize, c = a * 2, l = a * 3, u = s - t, h = (n - t) / u, f = h * h, d = f * h, g = e * l, m = g - l, p = -2 * d + 3 * f,
|
|
1738
|
+
const i = this.resultBuffer, r = this.sampleValues, a = this.valueSize, c = a * 2, l = a * 3, u = s - t, h = (n - t) / u, f = h * h, d = f * h, g = e * l, m = g - l, p = -2 * d + 3 * f, y = d - f, _ = 1 - p, T = y - f + h;
|
|
1638
1739
|
for (let w = 0; w !== a; w++) {
|
|
1639
|
-
const
|
|
1640
|
-
i[w] = _ *
|
|
1740
|
+
const E = r[m + w + a], L = r[m + w + c] * u, A = r[g + w + a], C = r[g + w] * u;
|
|
1741
|
+
i[w] = _ * E + T * L + p * A + y * C;
|
|
1641
1742
|
}
|
|
1642
1743
|
return i;
|
|
1643
1744
|
}
|
|
1644
1745
|
}
|
|
1645
|
-
const
|
|
1646
|
-
class
|
|
1746
|
+
const yn = new nt();
|
|
1747
|
+
class Tn extends Rt {
|
|
1647
1748
|
interpolate_(e, t, n, s) {
|
|
1648
1749
|
const i = super.interpolate_(e, t, n, s);
|
|
1649
|
-
return
|
|
1750
|
+
return yn.fromArray(i).normalize().toArray(i), i;
|
|
1650
1751
|
}
|
|
1651
1752
|
}
|
|
1652
1753
|
const k = {
|
|
@@ -1657,7 +1758,7 @@ const k = {
|
|
|
1657
1758
|
TRIANGLES: 4,
|
|
1658
1759
|
TRIANGLE_STRIP: 5,
|
|
1659
1760
|
TRIANGLE_FAN: 6
|
|
1660
|
-
},
|
|
1761
|
+
}, ee = {
|
|
1661
1762
|
5120: Int8Array,
|
|
1662
1763
|
5121: Uint8Array,
|
|
1663
1764
|
5122: Int16Array,
|
|
@@ -1665,17 +1766,17 @@ const k = {
|
|
|
1665
1766
|
5125: Uint32Array,
|
|
1666
1767
|
5126: Float32Array
|
|
1667
1768
|
}, Je = {
|
|
1668
|
-
9728:
|
|
1669
|
-
9729:
|
|
1769
|
+
9728: ct,
|
|
1770
|
+
9729: Ae,
|
|
1670
1771
|
9984: zt,
|
|
1671
1772
|
9985: Bt,
|
|
1672
1773
|
9986: Gt,
|
|
1673
|
-
9987:
|
|
1674
|
-
},
|
|
1774
|
+
9987: at
|
|
1775
|
+
}, Qe = {
|
|
1675
1776
|
33071: Kt,
|
|
1676
1777
|
33648: jt,
|
|
1677
|
-
10497:
|
|
1678
|
-
},
|
|
1778
|
+
10497: Se
|
|
1779
|
+
}, _e = {
|
|
1679
1780
|
SCALAR: 1,
|
|
1680
1781
|
VEC2: 2,
|
|
1681
1782
|
VEC3: 3,
|
|
@@ -1683,7 +1784,7 @@ const k = {
|
|
|
1683
1784
|
MAT2: 4,
|
|
1684
1785
|
MAT3: 9,
|
|
1685
1786
|
MAT4: 16
|
|
1686
|
-
},
|
|
1787
|
+
}, ke = {
|
|
1687
1788
|
POSITION: "position",
|
|
1688
1789
|
NORMAL: "normal",
|
|
1689
1790
|
TANGENT: "tangent",
|
|
@@ -1703,15 +1804,15 @@ const k = {
|
|
|
1703
1804
|
CUBICSPLINE: void 0,
|
|
1704
1805
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
1705
1806
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
1706
|
-
LINEAR:
|
|
1807
|
+
LINEAR: ut,
|
|
1707
1808
|
STEP: as
|
|
1708
|
-
},
|
|
1809
|
+
}, Re = {
|
|
1709
1810
|
OPAQUE: "OPAQUE",
|
|
1710
1811
|
MASK: "MASK",
|
|
1711
1812
|
BLEND: "BLEND"
|
|
1712
1813
|
};
|
|
1713
1814
|
function xn(o) {
|
|
1714
|
-
return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new
|
|
1815
|
+
return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new lt({
|
|
1715
1816
|
color: 16777215,
|
|
1716
1817
|
emissive: 0,
|
|
1717
1818
|
metalness: 1,
|
|
@@ -1721,11 +1822,11 @@ function xn(o) {
|
|
|
1721
1822
|
side: cs
|
|
1722
1823
|
})), o.DefaultMaterial;
|
|
1723
1824
|
}
|
|
1724
|
-
function
|
|
1825
|
+
function W(o, e, t) {
|
|
1725
1826
|
for (const n in t.extensions)
|
|
1726
1827
|
o[n] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[n] = t.extensions[n]);
|
|
1727
1828
|
}
|
|
1728
|
-
function
|
|
1829
|
+
function F(o, e) {
|
|
1729
1830
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(o.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
1730
1831
|
}
|
|
1731
1832
|
function _n(o, e, t) {
|
|
@@ -1774,22 +1875,22 @@ function Rn(o, e) {
|
|
|
1774
1875
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
1775
1876
|
}
|
|
1776
1877
|
}
|
|
1777
|
-
function
|
|
1878
|
+
function bn(o) {
|
|
1778
1879
|
let e;
|
|
1779
1880
|
const t = o.extensions && o.extensions[x.KHR_DRACO_MESH_COMPRESSION];
|
|
1780
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
1881
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + be(t.attributes) : e = o.indices + ":" + be(o.attributes) + ":" + o.mode, o.targets !== void 0)
|
|
1781
1882
|
for (let n = 0, s = o.targets.length; n < s; n++)
|
|
1782
|
-
e += ":" +
|
|
1883
|
+
e += ":" + be(o.targets[n]);
|
|
1783
1884
|
return e;
|
|
1784
1885
|
}
|
|
1785
|
-
function
|
|
1886
|
+
function be(o) {
|
|
1786
1887
|
let e = "";
|
|
1787
1888
|
const t = Object.keys(o).sort();
|
|
1788
1889
|
for (let n = 0, s = t.length; n < s; n++)
|
|
1789
1890
|
e += t[n] + ":" + o[t[n]] + ";";
|
|
1790
1891
|
return e;
|
|
1791
1892
|
}
|
|
1792
|
-
function
|
|
1893
|
+
function Ne(o) {
|
|
1793
1894
|
switch (o) {
|
|
1794
1895
|
case Int8Array:
|
|
1795
1896
|
return 1 / 127;
|
|
@@ -1803,13 +1904,13 @@ function ke(o) {
|
|
|
1803
1904
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
1804
1905
|
}
|
|
1805
1906
|
}
|
|
1806
|
-
function
|
|
1907
|
+
function En(o) {
|
|
1807
1908
|
return o.search(/\.jpe?g($|\?)/i) > 0 || o.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : o.search(/\.webp($|\?)/i) > 0 || o.search(/^data\:image\/webp/) === 0 ? "image/webp" : o.search(/\.ktx2($|\?)/i) > 0 || o.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
|
|
1808
1909
|
}
|
|
1809
1910
|
const Ln = new ue();
|
|
1810
1911
|
class An {
|
|
1811
1912
|
constructor(e = {}, t = {}) {
|
|
1812
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
1913
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Vs(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
|
|
1813
1914
|
let n = !1, s = -1, i = !1, r = -1;
|
|
1814
1915
|
if (typeof navigator < "u") {
|
|
1815
1916
|
const a = navigator.userAgent;
|
|
@@ -1847,7 +1948,7 @@ class An {
|
|
|
1847
1948
|
parser: n,
|
|
1848
1949
|
userData: {}
|
|
1849
1950
|
};
|
|
1850
|
-
return
|
|
1951
|
+
return W(i, a, s), F(a, s), Promise.all(n._invokeAll(function(c) {
|
|
1851
1952
|
return c.afterRoot && c.afterRoot(a);
|
|
1852
1953
|
})).then(function() {
|
|
1853
1954
|
for (const c of a.scenes)
|
|
@@ -2028,7 +2129,7 @@ class An {
|
|
|
2028
2129
|
return Promise.resolve(this.extensions[x.KHR_BINARY_GLTF].body);
|
|
2029
2130
|
const s = this.options;
|
|
2030
2131
|
return new Promise(function(i, r) {
|
|
2031
|
-
n.load(
|
|
2132
|
+
n.load(ie.resolveURL(t.uri, s.path), i, void 0, function() {
|
|
2032
2133
|
r(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
2033
2134
|
});
|
|
2034
2135
|
});
|
|
@@ -2057,24 +2158,24 @@ class An {
|
|
|
2057
2158
|
loadAccessor(e) {
|
|
2058
2159
|
const t = this, n = this.json, s = this.json.accessors[e];
|
|
2059
2160
|
if (s.bufferView === void 0 && s.sparse === void 0) {
|
|
2060
|
-
const r =
|
|
2061
|
-
return Promise.resolve(new
|
|
2161
|
+
const r = _e[s.type], a = ee[s.componentType], c = s.normalized === !0, l = new a(s.count * r);
|
|
2162
|
+
return Promise.resolve(new re(l, r, c));
|
|
2062
2163
|
}
|
|
2063
2164
|
const i = [];
|
|
2064
2165
|
return s.bufferView !== void 0 ? i.push(this.getDependency("bufferView", s.bufferView)) : i.push(null), s.sparse !== void 0 && (i.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(i).then(function(r) {
|
|
2065
|
-
const a = r[0], c =
|
|
2166
|
+
const a = r[0], c = _e[s.type], l = ee[s.componentType], u = l.BYTES_PER_ELEMENT, h = u * c, f = s.byteOffset || 0, d = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, g = s.normalized === !0;
|
|
2066
2167
|
let m, p;
|
|
2067
2168
|
if (d && d !== h) {
|
|
2068
|
-
const
|
|
2069
|
-
let
|
|
2070
|
-
|
|
2169
|
+
const y = Math.floor(f / d), _ = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + y + ":" + s.count;
|
|
2170
|
+
let T = t.cache.get(_);
|
|
2171
|
+
T || (m = new l(a, y * d, s.count * d / u), T = new rt(m, d / u), t.cache.add(_, T)), p = new ot(T, c, f % d / u, g);
|
|
2071
2172
|
} else
|
|
2072
|
-
a === null ? m = new l(s.count * c) : m = new l(a, f, s.count * c), p = new
|
|
2173
|
+
a === null ? m = new l(s.count * c) : m = new l(a, f, s.count * c), p = new re(m, c, g);
|
|
2073
2174
|
if (s.sparse !== void 0) {
|
|
2074
|
-
const
|
|
2075
|
-
a !== null && (p = new
|
|
2076
|
-
for (let A = 0,
|
|
2077
|
-
const M =
|
|
2175
|
+
const y = _e.SCALAR, _ = ee[s.sparse.indices.componentType], T = s.sparse.indices.byteOffset || 0, w = s.sparse.values.byteOffset || 0, E = new _(r[1], T, s.sparse.count * y), L = new l(r[2], w, s.sparse.count * c);
|
|
2176
|
+
a !== null && (p = new re(p.array.slice(), p.itemSize, p.normalized)), p.normalized = !1;
|
|
2177
|
+
for (let A = 0, C = E.length; A < C; A++) {
|
|
2178
|
+
const M = E[A];
|
|
2078
2179
|
if (p.setX(M, L[A * c]), c >= 2 && p.setY(M, L[A * c + 1]), c >= 3 && p.setZ(M, L[A * c + 2]), c >= 4 && p.setW(M, L[A * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
2079
2180
|
}
|
|
2080
2181
|
p.normalized = g;
|
|
@@ -2105,7 +2206,7 @@ class An {
|
|
|
2105
2206
|
const l = this.loadImageSource(t, n).then(function(u) {
|
|
2106
2207
|
u.flipY = !1, u.name = r.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
|
|
2107
2208
|
const f = (i.samplers || {})[r.sampler] || {};
|
|
2108
|
-
return u.magFilter = Je[f.magFilter] ||
|
|
2209
|
+
return u.magFilter = Je[f.magFilter] || Ae, u.minFilter = Je[f.minFilter] || at, u.wrapS = Qe[f.wrapS] || Se, u.wrapT = Qe[f.wrapT] || Se, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== ct && u.minFilter !== Ae, s.associations.set(u, { textures: e }), u;
|
|
2109
2210
|
}).catch(function() {
|
|
2110
2211
|
return null;
|
|
2111
2212
|
});
|
|
@@ -2129,12 +2230,12 @@ class An {
|
|
|
2129
2230
|
return new Promise(function(f, d) {
|
|
2130
2231
|
let g = f;
|
|
2131
2232
|
t.isImageBitmapLoader === !0 && (g = function(m) {
|
|
2132
|
-
const p = new
|
|
2233
|
+
const p = new Ke(m);
|
|
2133
2234
|
p.needsUpdate = !0, f(p);
|
|
2134
|
-
}), t.load(
|
|
2235
|
+
}), t.load(ie.resolveURL(h, i.path), g, void 0, d);
|
|
2135
2236
|
});
|
|
2136
2237
|
}).then(function(h) {
|
|
2137
|
-
return l === !0 && a.revokeObjectURL(c),
|
|
2238
|
+
return l === !0 && a.revokeObjectURL(c), F(h, r), h.userData.mimeType = r.mimeType || En(r.uri), h;
|
|
2138
2239
|
}).catch(function(h) {
|
|
2139
2240
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", c), h;
|
|
2140
2241
|
});
|
|
@@ -2181,11 +2282,11 @@ class An {
|
|
|
2181
2282
|
if (e.isPoints) {
|
|
2182
2283
|
const a = "PointsMaterial:" + n.uuid;
|
|
2183
2284
|
let c = this.cache.get(a);
|
|
2184
|
-
c || (c = new Xt(),
|
|
2285
|
+
c || (c = new Xt(), ge.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, c.sizeAttenuation = !1, this.cache.add(a, c)), n = c;
|
|
2185
2286
|
} else if (e.isLine) {
|
|
2186
2287
|
const a = "LineBasicMaterial:" + n.uuid;
|
|
2187
2288
|
let c = this.cache.get(a);
|
|
2188
|
-
c || (c = new
|
|
2289
|
+
c || (c = new Wt(), ge.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, this.cache.add(a, c)), n = c;
|
|
2189
2290
|
}
|
|
2190
2291
|
if (s || i || r) {
|
|
2191
2292
|
let a = "ClonedMaterial:" + n.uuid + ":";
|
|
@@ -2196,7 +2297,7 @@ class An {
|
|
|
2196
2297
|
e.material = n;
|
|
2197
2298
|
}
|
|
2198
2299
|
getMaterialType() {
|
|
2199
|
-
return
|
|
2300
|
+
return lt;
|
|
2200
2301
|
}
|
|
2201
2302
|
/**
|
|
2202
2303
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -2224,19 +2325,19 @@ class An {
|
|
|
2224
2325
|
return f.extendMaterialParams && f.extendMaterialParams(e, a);
|
|
2225
2326
|
})));
|
|
2226
2327
|
}
|
|
2227
|
-
i.doubleSided === !0 && (a.side =
|
|
2228
|
-
const u = i.alphaMode ||
|
|
2229
|
-
if (u ===
|
|
2328
|
+
i.doubleSided === !0 && (a.side = Vt);
|
|
2329
|
+
const u = i.alphaMode || Re.OPAQUE;
|
|
2330
|
+
if (u === Re.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === Re.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && r !== ne && (l.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new st(1, 1), i.normalTexture.scale !== void 0)) {
|
|
2230
2331
|
const h = i.normalTexture.scale;
|
|
2231
2332
|
a.normalScale.set(h, h);
|
|
2232
2333
|
}
|
|
2233
|
-
if (i.occlusionTexture !== void 0 && r !==
|
|
2334
|
+
if (i.occlusionTexture !== void 0 && r !== ne && (l.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && r !== ne) {
|
|
2234
2335
|
const h = i.emissiveFactor;
|
|
2235
2336
|
a.emissive = new X().setRGB(h[0], h[1], h[2], U);
|
|
2236
2337
|
}
|
|
2237
|
-
return i.emissiveTexture !== void 0 && r !==
|
|
2338
|
+
return i.emissiveTexture !== void 0 && r !== ne && l.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, K)), Promise.all(l).then(function() {
|
|
2238
2339
|
const h = new r(a);
|
|
2239
|
-
return i.name && (h.name = i.name),
|
|
2340
|
+
return i.name && (h.name = i.name), F(h, i), t.associations.set(h, { materials: e }), i.extensions && W(s, h, i), h;
|
|
2240
2341
|
});
|
|
2241
2342
|
}
|
|
2242
2343
|
/**
|
|
@@ -2263,17 +2364,17 @@ class An {
|
|
|
2263
2364
|
const t = this, n = this.extensions, s = this.primitiveCache;
|
|
2264
2365
|
function i(a) {
|
|
2265
2366
|
return n[x.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) {
|
|
2266
|
-
return
|
|
2367
|
+
return Ze(c, a, t);
|
|
2267
2368
|
});
|
|
2268
2369
|
}
|
|
2269
2370
|
const r = [];
|
|
2270
2371
|
for (let a = 0, c = e.length; a < c; a++) {
|
|
2271
|
-
const l = e[a], u =
|
|
2372
|
+
const l = e[a], u = bn(l), h = s[u];
|
|
2272
2373
|
if (h)
|
|
2273
2374
|
r.push(h.promise);
|
|
2274
2375
|
else {
|
|
2275
2376
|
let f;
|
|
2276
|
-
l.extensions && l.extensions[x.KHR_DRACO_MESH_COMPRESSION] ? f = i(l) : f =
|
|
2377
|
+
l.extensions && l.extensions[x.KHR_DRACO_MESH_COMPRESSION] ? f = i(l) : f = Ze(new ht(), l, t), s[u] = { primitive: l, promise: f }, r.push(f);
|
|
2277
2378
|
}
|
|
2278
2379
|
}
|
|
2279
2380
|
return Promise.all(r);
|
|
@@ -2295,21 +2396,21 @@ class An {
|
|
|
2295
2396
|
const l = c.slice(0, c.length - 1), u = c[c.length - 1], h = [];
|
|
2296
2397
|
for (let d = 0, g = u.length; d < g; d++) {
|
|
2297
2398
|
const m = u[d], p = r[d];
|
|
2298
|
-
let
|
|
2399
|
+
let y;
|
|
2299
2400
|
const _ = l[d];
|
|
2300
2401
|
if (p.mode === k.TRIANGLES || p.mode === k.TRIANGLE_STRIP || p.mode === k.TRIANGLE_FAN || p.mode === void 0)
|
|
2301
|
-
|
|
2402
|
+
y = i.isSkinnedMesh === !0 ? new $t(m, _) : new qt(m, _), y.isSkinnedMesh === !0 && y.normalizeSkinWeights(), p.mode === k.TRIANGLE_STRIP ? y.geometry = $e(y.geometry, et) : p.mode === k.TRIANGLE_FAN && (y.geometry = $e(y.geometry, Le));
|
|
2302
2403
|
else if (p.mode === k.LINES)
|
|
2303
|
-
|
|
2404
|
+
y = new Jt(m, _);
|
|
2304
2405
|
else if (p.mode === k.LINE_STRIP)
|
|
2305
|
-
|
|
2406
|
+
y = new Qt(m, _);
|
|
2306
2407
|
else if (p.mode === k.LINE_LOOP)
|
|
2307
|
-
|
|
2408
|
+
y = new Zt(m, _);
|
|
2308
2409
|
else if (p.mode === k.POINTS)
|
|
2309
|
-
|
|
2410
|
+
y = new es(m, _);
|
|
2310
2411
|
else
|
|
2311
2412
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + p.mode);
|
|
2312
|
-
Object.keys(
|
|
2413
|
+
Object.keys(y.geometry.morphAttributes).length > 0 && Rn(y, i), y.name = t.createUniqueName(i.name || "mesh_" + e), F(y, i), p.extensions && W(s, y, p), t.assignFinalMaterial(y), h.push(y);
|
|
2313
2414
|
}
|
|
2314
2415
|
for (let d = 0, g = h.length; d < g; d++)
|
|
2315
2416
|
t.associations.set(h[d], {
|
|
@@ -2317,9 +2418,9 @@ class An {
|
|
|
2317
2418
|
primitives: d
|
|
2318
2419
|
});
|
|
2319
2420
|
if (h.length === 1)
|
|
2320
|
-
return i.extensions &&
|
|
2321
|
-
const f = new
|
|
2322
|
-
i.extensions &&
|
|
2421
|
+
return i.extensions && W(s, h[0], i), h[0];
|
|
2422
|
+
const f = new ye();
|
|
2423
|
+
i.extensions && W(s, f, i), t.associations.set(f, { meshes: e });
|
|
2323
2424
|
for (let d = 0, g = h.length; d < g; d++)
|
|
2324
2425
|
f.add(h[d]);
|
|
2325
2426
|
return f;
|
|
@@ -2339,7 +2440,7 @@ class An {
|
|
|
2339
2440
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
2340
2441
|
return;
|
|
2341
2442
|
}
|
|
2342
|
-
return n.type === "perspective" ? t = new ts(ss.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new ns(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (t.name = this.createUniqueName(n.name)),
|
|
2443
|
+
return n.type === "perspective" ? t = new ts(ss.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new ns(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (t.name = this.createUniqueName(n.name)), F(t, n), Promise.resolve(t);
|
|
2343
2444
|
}
|
|
2344
2445
|
/**
|
|
2345
2446
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -2376,8 +2477,8 @@ class An {
|
|
|
2376
2477
|
loadAnimation(e) {
|
|
2377
2478
|
const t = this.json, n = this, s = t.animations[e], i = s.name ? s.name : "animation_" + e, r = [], a = [], c = [], l = [], u = [];
|
|
2378
2479
|
for (let h = 0, f = s.channels.length; h < f; h++) {
|
|
2379
|
-
const d = s.channels[h], g = s.samplers[d.sampler], m = d.target, p = m.node,
|
|
2380
|
-
m.node !== void 0 && (r.push(this.getDependency("node", p)), a.push(this.getDependency("accessor",
|
|
2480
|
+
const d = s.channels[h], g = s.samplers[d.sampler], m = d.target, p = m.node, y = s.parameters !== void 0 ? s.parameters[g.input] : g.input, _ = s.parameters !== void 0 ? s.parameters[g.output] : g.output;
|
|
2481
|
+
m.node !== void 0 && (r.push(this.getDependency("node", p)), a.push(this.getDependency("accessor", y)), c.push(this.getDependency("accessor", _)), l.push(g), u.push(m));
|
|
2381
2482
|
}
|
|
2382
2483
|
return Promise.all([
|
|
2383
2484
|
Promise.all(r),
|
|
@@ -2386,18 +2487,18 @@ class An {
|
|
|
2386
2487
|
Promise.all(l),
|
|
2387
2488
|
Promise.all(u)
|
|
2388
2489
|
]).then(function(h) {
|
|
2389
|
-
const f = h[0], d = h[1], g = h[2], m = h[3], p = h[4],
|
|
2390
|
-
for (let
|
|
2391
|
-
const
|
|
2392
|
-
if (
|
|
2393
|
-
|
|
2394
|
-
const I = n._createAnimationTracks(
|
|
2490
|
+
const f = h[0], d = h[1], g = h[2], m = h[3], p = h[4], y = [];
|
|
2491
|
+
for (let T = 0, w = f.length; T < w; T++) {
|
|
2492
|
+
const E = f[T], L = d[T], A = g[T], C = m[T], M = p[T];
|
|
2493
|
+
if (E === void 0) continue;
|
|
2494
|
+
E.updateMatrix && E.updateMatrix();
|
|
2495
|
+
const I = n._createAnimationTracks(E, L, A, C, M);
|
|
2395
2496
|
if (I)
|
|
2396
2497
|
for (let S = 0; S < I.length; S++)
|
|
2397
|
-
|
|
2498
|
+
y.push(I[S]);
|
|
2398
2499
|
}
|
|
2399
|
-
const _ = new rs(i, void 0,
|
|
2400
|
-
return
|
|
2500
|
+
const _ = new rs(i, void 0, y);
|
|
2501
|
+
return F(_, s), _;
|
|
2401
2502
|
});
|
|
2402
2503
|
}
|
|
2403
2504
|
createNodeMesh(e) {
|
|
@@ -2454,10 +2555,10 @@ class An {
|
|
|
2454
2555
|
a.push(l);
|
|
2455
2556
|
}), this.nodeCache[e] = Promise.all(a).then(function(l) {
|
|
2456
2557
|
let u;
|
|
2457
|
-
if (i.isBone === !0 ? u = new os() : l.length > 1 ? u = new
|
|
2558
|
+
if (i.isBone === !0 ? u = new os() : l.length > 1 ? u = new ye() : l.length === 1 ? u = l[0] : u = new it(), u !== l[0])
|
|
2458
2559
|
for (let h = 0, f = l.length; h < f; h++)
|
|
2459
2560
|
u.add(l[h]);
|
|
2460
|
-
if (i.name && (u.userData.name = i.name, u.name = r),
|
|
2561
|
+
if (i.name && (u.userData.name = i.name, u.name = r), F(u, i), i.extensions && W(n, u, i), i.matrix !== void 0) {
|
|
2461
2562
|
const h = new ue();
|
|
2462
2563
|
h.fromArray(i.matrix), u.applyMatrix4(h);
|
|
2463
2564
|
} else
|
|
@@ -2479,8 +2580,8 @@ class An {
|
|
|
2479
2580
|
* @return {Promise<Group>}
|
|
2480
2581
|
*/
|
|
2481
2582
|
loadScene(e) {
|
|
2482
|
-
const t = this.extensions, n = this.json.scenes[e], s = this, i = new
|
|
2483
|
-
n.name && (i.name = s.createUniqueName(n.name)),
|
|
2583
|
+
const t = this.extensions, n = this.json.scenes[e], s = this, i = new ye();
|
|
2584
|
+
n.name && (i.name = s.createUniqueName(n.name)), F(i, n), n.extensions && W(t, i, n);
|
|
2484
2585
|
const r = n.nodes || [], a = [];
|
|
2485
2586
|
for (let c = 0, l = r.length; c < l; c++)
|
|
2486
2587
|
a.push(s.getDependency("node", r[c]));
|
|
@@ -2490,7 +2591,7 @@ class An {
|
|
|
2490
2591
|
const l = (u) => {
|
|
2491
2592
|
const h = /* @__PURE__ */ new Map();
|
|
2492
2593
|
for (const [f, d] of s.associations)
|
|
2493
|
-
(f instanceof
|
|
2594
|
+
(f instanceof ge || f instanceof Ke) && h.set(f, d);
|
|
2494
2595
|
return u.traverse((f) => {
|
|
2495
2596
|
const d = s.associations.get(f);
|
|
2496
2597
|
d != null && h.set(f, d);
|
|
@@ -2507,20 +2608,20 @@ class An {
|
|
|
2507
2608
|
let l;
|
|
2508
2609
|
switch (j[i.path]) {
|
|
2509
2610
|
case j.weights:
|
|
2510
|
-
l =
|
|
2611
|
+
l = We;
|
|
2511
2612
|
break;
|
|
2512
2613
|
case j.rotation:
|
|
2513
2614
|
l = Ve;
|
|
2514
2615
|
break;
|
|
2515
2616
|
case j.translation:
|
|
2516
2617
|
case j.scale:
|
|
2517
|
-
l =
|
|
2618
|
+
l = Xe;
|
|
2518
2619
|
break;
|
|
2519
2620
|
default:
|
|
2520
|
-
n.itemSize === 1 ? l =
|
|
2621
|
+
n.itemSize === 1 ? l = We : l = Xe;
|
|
2521
2622
|
break;
|
|
2522
2623
|
}
|
|
2523
|
-
const u = s.interpolation !== void 0 ? wn[s.interpolation] :
|
|
2624
|
+
const u = s.interpolation !== void 0 ? wn[s.interpolation] : ut, h = this._getArrayFromAccessor(n);
|
|
2524
2625
|
for (let f = 0, d = c.length; f < d; f++) {
|
|
2525
2626
|
const g = new l(
|
|
2526
2627
|
c[f] + "." + j[i.path],
|
|
@@ -2535,7 +2636,7 @@ class An {
|
|
|
2535
2636
|
_getArrayFromAccessor(e) {
|
|
2536
2637
|
let t = e.array;
|
|
2537
2638
|
if (e.normalized) {
|
|
2538
|
-
const n =
|
|
2639
|
+
const n = Ne(t.constructor), s = new Float32Array(t.length);
|
|
2539
2640
|
for (let i = 0, r = t.length; i < r; i++)
|
|
2540
2641
|
s[i] = t[i] * n;
|
|
2541
2642
|
t = s;
|
|
@@ -2544,7 +2645,7 @@ class An {
|
|
|
2544
2645
|
}
|
|
2545
2646
|
_createCubicSplineTrackInterpolant(e) {
|
|
2546
2647
|
e.createInterpolant = function(n) {
|
|
2547
|
-
const s = this instanceof Ve ?
|
|
2648
|
+
const s = this instanceof Ve ? Tn : Rt;
|
|
2548
2649
|
return new s(this.times, this.values, this.getValueSize() / 3, n);
|
|
2549
2650
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
2550
2651
|
}
|
|
@@ -2555,10 +2656,10 @@ function Sn(o, e, t) {
|
|
|
2555
2656
|
const a = t.json.accessors[n.POSITION], c = a.min, l = a.max;
|
|
2556
2657
|
if (c !== void 0 && l !== void 0) {
|
|
2557
2658
|
if (s.set(
|
|
2558
|
-
new
|
|
2559
|
-
new
|
|
2659
|
+
new q(c[0], c[1], c[2]),
|
|
2660
|
+
new q(l[0], l[1], l[2])
|
|
2560
2661
|
), a.normalized) {
|
|
2561
|
-
const u =
|
|
2662
|
+
const u = Ne(ee[a.componentType]);
|
|
2562
2663
|
s.min.multiplyScalar(u), s.max.multiplyScalar(u);
|
|
2563
2664
|
}
|
|
2564
2665
|
} else {
|
|
@@ -2569,14 +2670,14 @@ function Sn(o, e, t) {
|
|
|
2569
2670
|
return;
|
|
2570
2671
|
const i = e.targets;
|
|
2571
2672
|
if (i !== void 0) {
|
|
2572
|
-
const a = new
|
|
2673
|
+
const a = new q(), c = new q();
|
|
2573
2674
|
for (let l = 0, u = i.length; l < u; l++) {
|
|
2574
2675
|
const h = i[l];
|
|
2575
2676
|
if (h.POSITION !== void 0) {
|
|
2576
2677
|
const f = t.json.accessors[h.POSITION], d = f.min, g = f.max;
|
|
2577
2678
|
if (d !== void 0 && g !== void 0) {
|
|
2578
2679
|
if (c.setX(Math.max(Math.abs(d[0]), Math.abs(g[0]))), c.setY(Math.max(Math.abs(d[1]), Math.abs(g[1]))), c.setZ(Math.max(Math.abs(d[2]), Math.abs(g[2]))), f.normalized) {
|
|
2579
|
-
const m =
|
|
2680
|
+
const m = Ne(ee[f.componentType]);
|
|
2580
2681
|
c.multiplyScalar(m);
|
|
2581
2682
|
}
|
|
2582
2683
|
a.max(c);
|
|
@@ -2590,7 +2691,7 @@ function Sn(o, e, t) {
|
|
|
2590
2691
|
const r = new us();
|
|
2591
2692
|
s.getCenter(r.center), r.radius = s.min.distanceTo(s.max) / 2, o.boundingSphere = r;
|
|
2592
2693
|
}
|
|
2593
|
-
function
|
|
2694
|
+
function Ze(o, e, t) {
|
|
2594
2695
|
const n = e.attributes, s = [];
|
|
2595
2696
|
function i(r, a) {
|
|
2596
2697
|
return t.getDependency("accessor", r).then(function(c) {
|
|
@@ -2598,7 +2699,7 @@ function Qe(o, e, t) {
|
|
|
2598
2699
|
});
|
|
2599
2700
|
}
|
|
2600
2701
|
for (const r in n) {
|
|
2601
|
-
const a =
|
|
2702
|
+
const a = ke[r] || r.toLowerCase();
|
|
2602
2703
|
a in o.attributes || s.push(i(n[r], a));
|
|
2603
2704
|
}
|
|
2604
2705
|
if (e.indices !== void 0 && !o.index) {
|
|
@@ -2607,12 +2708,12 @@ function Qe(o, e, t) {
|
|
|
2607
2708
|
});
|
|
2608
2709
|
s.push(r);
|
|
2609
2710
|
}
|
|
2610
|
-
return
|
|
2711
|
+
return Me.workingColorSpace !== U && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Me.workingColorSpace}" not supported.`), F(o, e), Sn(o, e, t), Promise.all(s).then(function() {
|
|
2611
2712
|
return e.targets !== void 0 ? _n(o, e.targets, t) : o;
|
|
2612
2713
|
});
|
|
2613
2714
|
}
|
|
2614
2715
|
const Ee = /* @__PURE__ */ new WeakMap();
|
|
2615
|
-
class Mn extends
|
|
2716
|
+
class Mn extends tt {
|
|
2616
2717
|
/**
|
|
2617
2718
|
* Constructs a new Draco loader.
|
|
2618
2719
|
*
|
|
@@ -2719,16 +2820,16 @@ class Mn extends et {
|
|
|
2719
2820
|
}), a;
|
|
2720
2821
|
}
|
|
2721
2822
|
_createGeometry(e) {
|
|
2722
|
-
const t = new
|
|
2723
|
-
e.index && t.setIndex(new
|
|
2823
|
+
const t = new ht();
|
|
2824
|
+
e.index && t.setIndex(new re(e.index.array, 1));
|
|
2724
2825
|
for (let n = 0; n < e.attributes.length; n++) {
|
|
2725
2826
|
const { name: s, array: i, itemSize: r, stride: a, vertexColorSpace: c } = e.attributes[n];
|
|
2726
2827
|
let l;
|
|
2727
2828
|
if (r === a)
|
|
2728
|
-
l = new
|
|
2829
|
+
l = new re(i, r);
|
|
2729
2830
|
else {
|
|
2730
|
-
const u = new
|
|
2731
|
-
l = new
|
|
2831
|
+
const u = new rt(i, a);
|
|
2832
|
+
l = new ot(u, r, 0);
|
|
2732
2833
|
}
|
|
2733
2834
|
s === "color" && (this._assignVertexColorSpace(l, c), l.normalized = !(i instanceof Float32Array)), t.setAttribute(s, l);
|
|
2734
2835
|
}
|
|
@@ -2738,7 +2839,7 @@ class Mn extends et {
|
|
|
2738
2839
|
if (t !== K) return;
|
|
2739
2840
|
const n = new X();
|
|
2740
2841
|
for (let s = 0, i = e.count; s < i; s++)
|
|
2741
|
-
n.fromBufferAttribute(e, s),
|
|
2842
|
+
n.fromBufferAttribute(e, s), Me.colorSpaceToWorking(n, K), e.setXYZ(s, n.r, n.g, n.b);
|
|
2742
2843
|
}
|
|
2743
2844
|
_loadLibrary(e, t) {
|
|
2744
2845
|
const n = new he(this.manager);
|
|
@@ -2755,7 +2856,7 @@ class Mn extends et {
|
|
|
2755
2856
|
return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((n) => {
|
|
2756
2857
|
const s = n[0];
|
|
2757
2858
|
e || (this.decoderConfig.wasmBinary = n[1]);
|
|
2758
|
-
const i =
|
|
2859
|
+
const i = vn.toString(), r = [
|
|
2759
2860
|
"/* draco decoder */",
|
|
2760
2861
|
s,
|
|
2761
2862
|
"",
|
|
@@ -2803,7 +2904,7 @@ class Mn extends et {
|
|
|
2803
2904
|
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
|
|
2804
2905
|
}
|
|
2805
2906
|
}
|
|
2806
|
-
function
|
|
2907
|
+
function vn() {
|
|
2807
2908
|
let o, e;
|
|
2808
2909
|
onmessage = function(r) {
|
|
2809
2910
|
const a = r.data;
|
|
@@ -2845,15 +2946,15 @@ function Cn() {
|
|
|
2845
2946
|
throw new Error("THREE.DRACOLoader: Decoding failed: " + d.error_msg());
|
|
2846
2947
|
const m = { index: null, attributes: [] };
|
|
2847
2948
|
for (const p in u) {
|
|
2848
|
-
const
|
|
2849
|
-
let _,
|
|
2949
|
+
const y = self[h[p]];
|
|
2950
|
+
let _, T;
|
|
2850
2951
|
if (l.useUniqueIDs)
|
|
2851
|
-
|
|
2952
|
+
T = u[p], _ = a.GetAttributeByUniqueId(f, T);
|
|
2852
2953
|
else {
|
|
2853
|
-
if (
|
|
2854
|
-
_ = a.GetAttribute(f,
|
|
2954
|
+
if (T = a.GetAttributeId(f, r[u[p]]), T === -1) continue;
|
|
2955
|
+
_ = a.GetAttribute(f, T);
|
|
2855
2956
|
}
|
|
2856
|
-
const w = s(r, a, f, p,
|
|
2957
|
+
const w = s(r, a, f, p, y, _);
|
|
2857
2958
|
p === "color" && (w.vertexColorSpace = l.vertexColorSpace), m.attributes.push(w);
|
|
2858
2959
|
}
|
|
2859
2960
|
return g === r.TRIANGULAR_MESH && (m.index = n(r, a, f)), r.destroy(f), m;
|
|
@@ -2865,19 +2966,19 @@ function Cn() {
|
|
|
2865
2966
|
return r._free(f), { array: d, itemSize: 1 };
|
|
2866
2967
|
}
|
|
2867
2968
|
function s(r, a, c, l, u, h) {
|
|
2868
|
-
const f = c.num_points(), d = h.num_components(), g = i(r, u), m = d * u.BYTES_PER_ELEMENT, p = Math.ceil(m / 4) * 4,
|
|
2969
|
+
const f = c.num_points(), d = h.num_components(), g = i(r, u), m = d * u.BYTES_PER_ELEMENT, p = Math.ceil(m / 4) * 4, y = p / u.BYTES_PER_ELEMENT, _ = f * m, T = f * p, w = r._malloc(_);
|
|
2869
2970
|
a.GetAttributeDataArrayForAllPoints(c, h, g, _, w);
|
|
2870
|
-
const
|
|
2971
|
+
const E = new u(r.HEAPF32.buffer, w, _ / u.BYTES_PER_ELEMENT);
|
|
2871
2972
|
let L;
|
|
2872
2973
|
if (m === p)
|
|
2873
|
-
L =
|
|
2974
|
+
L = E.slice();
|
|
2874
2975
|
else {
|
|
2875
|
-
L = new u(
|
|
2976
|
+
L = new u(T / u.BYTES_PER_ELEMENT);
|
|
2876
2977
|
let A = 0;
|
|
2877
|
-
for (let
|
|
2978
|
+
for (let C = 0, M = E.length; C < M; C++) {
|
|
2878
2979
|
for (let I = 0; I < d; I++)
|
|
2879
|
-
L[A + I] =
|
|
2880
|
-
A +=
|
|
2980
|
+
L[A + I] = E[C * d + I];
|
|
2981
|
+
A += y;
|
|
2881
2982
|
}
|
|
2882
2983
|
}
|
|
2883
2984
|
return r._free(w), {
|
|
@@ -2885,7 +2986,7 @@ function Cn() {
|
|
|
2885
2986
|
count: f,
|
|
2886
2987
|
itemSize: d,
|
|
2887
2988
|
array: L,
|
|
2888
|
-
stride:
|
|
2989
|
+
stride: y
|
|
2889
2990
|
};
|
|
2890
2991
|
}
|
|
2891
2992
|
function i(r, a) {
|
|
@@ -2907,24 +3008,24 @@ function Cn() {
|
|
|
2907
3008
|
}
|
|
2908
3009
|
}
|
|
2909
3010
|
}
|
|
2910
|
-
function
|
|
3011
|
+
function Cn(o) {
|
|
2911
3012
|
return "morphTargetDictionary" in o && o.morphTargetDictionary !== void 0 && "morphTargetInfluences" in o && Array.isArray(o.morphTargetInfluences);
|
|
2912
3013
|
}
|
|
2913
|
-
const
|
|
2914
|
-
|
|
2915
|
-
|
|
3014
|
+
const bt = new Ws(), Et = new Mn();
|
|
3015
|
+
Et.setDecoderPath("/examples/jsm/libs/draco/");
|
|
3016
|
+
bt.setDRACOLoader(Et);
|
|
2916
3017
|
class Pn extends ae {
|
|
2917
3018
|
ready;
|
|
2918
3019
|
model = null;
|
|
2919
3020
|
constructor(e) {
|
|
2920
|
-
super(), this.ready = this.asyncInit(e), this.
|
|
3021
|
+
super(), this.ready = this.asyncInit(e), this.setControlMode("user");
|
|
2921
3022
|
}
|
|
2922
3023
|
initObject() {
|
|
2923
|
-
return new
|
|
3024
|
+
return new R.Object3D();
|
|
2924
3025
|
}
|
|
2925
3026
|
async asyncInit(e) {
|
|
2926
3027
|
if (dt(e)) {
|
|
2927
|
-
const t = await
|
|
3028
|
+
const t = await bt.loadAsync(e), n = new R.AnimationMixer(t.scene), s = {};
|
|
2928
3029
|
console.log(`File: ${e}`), console.log(" actions:");
|
|
2929
3030
|
for (let r = 0; r < t.animations.length; r++) {
|
|
2930
3031
|
const a = t.animations[r], c = n.clipAction(a);
|
|
@@ -2933,7 +3034,7 @@ class Pn extends ae {
|
|
|
2933
3034
|
console.log(" morphs:");
|
|
2934
3035
|
const i = {};
|
|
2935
3036
|
t.scene.traverse((r) => {
|
|
2936
|
-
if (
|
|
3037
|
+
if (Cn(r)) {
|
|
2937
3038
|
const { morphTargetDictionary: a, morphTargetInfluences: c } = r;
|
|
2938
3039
|
Object.keys(a).forEach((l) => {
|
|
2939
3040
|
const u = r.name + "." + l, h = a[l];
|
|
@@ -2947,7 +3048,7 @@ class Pn extends ae {
|
|
|
2947
3048
|
morphs: i
|
|
2948
3049
|
}, this.object.add(this.model.gltf.scene);
|
|
2949
3050
|
} else {
|
|
2950
|
-
const t = new
|
|
3051
|
+
const t = new R.BoxGeometry(), n = new R.MeshStandardMaterial({ color: 16711680 }), s = new R.Mesh(t, n);
|
|
2951
3052
|
this.object.add(s);
|
|
2952
3053
|
}
|
|
2953
3054
|
return this;
|
|
@@ -2989,18 +3090,18 @@ function Hn(o) {
|
|
|
2989
3090
|
}
|
|
2990
3091
|
export {
|
|
2991
3092
|
gs as A3Camera,
|
|
2992
|
-
|
|
3093
|
+
Ts as A3Canvas,
|
|
2993
3094
|
ae as A3Object,
|
|
2994
|
-
|
|
3095
|
+
J as A3Scene,
|
|
2995
3096
|
kn as A3Test,
|
|
2996
3097
|
Dn as A3Text3D,
|
|
2997
|
-
|
|
3098
|
+
ft as A3ViewBase,
|
|
2998
3099
|
Rs as A3Window,
|
|
2999
3100
|
Pn as A3glTF,
|
|
3000
|
-
|
|
3001
|
-
|
|
3101
|
+
fe as GeneralCamera,
|
|
3102
|
+
Z as Quat,
|
|
3002
3103
|
On as ThreeJS,
|
|
3003
|
-
|
|
3104
|
+
D as Vec3,
|
|
3004
3105
|
Hn as asyncSleep,
|
|
3005
3106
|
Nn as initFont,
|
|
3006
3107
|
Fn as times2
|