@realsee/dnalogel 3.77.4-alpha.3 → 3.77.4-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +42 -42
- package/dist/index.js +4361 -4360
- package/dist/index.umd.js +43 -43
- package/libs/DigitalPerformancePlugin/mock.js +52 -51
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import * as _ from "three";
|
|
2
|
-
function
|
|
3
|
-
const m = [t[12], t[13], t[14]], r = t[0], o = t[4], l = t[8], p = t[1], x = t[5], h = t[9], e = t[2], u = t[6],
|
|
2
|
+
function J(t) {
|
|
3
|
+
const m = [t[12], t[13], t[14]], r = t[0], o = t[4], l = t[8], p = t[1], x = t[5], h = t[9], e = t[2], u = t[6], z = t[10], w = Math.sqrt(r * r + p * p + e * e), q = Math.sqrt(o * o + x * x + u * u), F = Math.sqrt(l * l + h * h + z * z), E = [w, q, F], N = [r / w, o / q, l / F, p / w, x / q, h / F, e / w, u / q, z / F], S = it(N);
|
|
4
4
|
return { position: m, quaternion: S, scale: E };
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function it(t) {
|
|
7
7
|
const m = t[0] + t[4] + t[8];
|
|
8
8
|
let r, o = [0, 0, 0, 0];
|
|
9
9
|
return m > 0 ? (r = Math.sqrt(m + 1) * 2, o[3] = 0.25 * r, o[0] = (t[7] - t[5]) / r, o[1] = (t[2] - t[6]) / r, o[2] = (t[3] - t[1]) / r) : t[0] > t[4] && t[0] > t[8] ? (r = Math.sqrt(1 + t[0] - t[4] - t[8]) * 2, o[3] = (t[7] - t[5]) / r, o[0] = 0.25 * r, o[1] = (t[1] + t[3]) / r, o[2] = (t[2] + t[6]) / r) : t[4] > t[8] ? (r = Math.sqrt(1 + t[4] - t[0] - t[8]) * 2, o[3] = (t[2] - t[6]) / r, o[0] = (t[1] + t[3]) / r, o[1] = 0.25 * r, o[2] = (t[5] + t[7]) / r) : (r = Math.sqrt(1 + t[8] - t[0] - t[4]) * 2, o[3] = (t[3] - t[1]) / r, o[0] = (t[2] + t[6]) / r, o[1] = (t[5] + t[7]) / r, o[2] = 0.25 * r), o;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function ot({ x: t, y: m, z: r, order: o = "XYZ" }) {
|
|
12
12
|
const l = Math.cos(t / 2), p = Math.cos(m / 2), x = Math.cos(r / 2), h = Math.sin(t / 2), e = Math.sin(m / 2), u = Math.sin(r / 2);
|
|
13
|
-
let
|
|
13
|
+
let z, w, q, F;
|
|
14
14
|
switch (o) {
|
|
15
15
|
case "XYZ":
|
|
16
|
-
|
|
16
|
+
z = h * p * x + l * e * u, w = l * e * x - h * p * u, q = l * p * u + h * e * x, F = l * p * x - h * e * u;
|
|
17
17
|
break;
|
|
18
18
|
default:
|
|
19
|
-
|
|
19
|
+
z = h * p * x + l * e * u, w = l * e * x - h * p * u, q = l * p * u + h * e * x, F = l * p * x - h * e * u;
|
|
20
20
|
}
|
|
21
|
-
return [
|
|
21
|
+
return [z, w, q, F];
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function W(t) {
|
|
24
24
|
if (typeof t == "string" && !isNaN(Number(t)))
|
|
25
25
|
return [0, -(Number(t) * Math.PI) / 180, 0];
|
|
26
26
|
if (Array.isArray(t) && t.length === 3)
|
|
27
27
|
return [t[0], -t[1], t[2]];
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function D(t, m) {
|
|
30
30
|
if (!m)
|
|
31
31
|
return t;
|
|
32
|
-
const r =
|
|
32
|
+
const r = ot({ x: m[0], y: m[1], z: m[2] }), [o, l, p, x] = r, [h, e, u, z] = t;
|
|
33
33
|
return [
|
|
34
|
-
x * h + o *
|
|
35
|
-
x * e - o * u + l *
|
|
36
|
-
x * u + o * e - l * h + p *
|
|
37
|
-
x *
|
|
34
|
+
x * h + o * z + l * u - p * e,
|
|
35
|
+
x * e - o * u + l * z + p * h,
|
|
36
|
+
x * u + o * e - l * h + p * z,
|
|
37
|
+
x * z - o * h - l * e - p * u
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function et(t, m) {
|
|
41
41
|
const r = new _.Vector3(m.x - t.x, m.y - t.y, m.z - t.z).normalize(), o = new _.Vector3(0, 0, 1), l = new _.Quaternion();
|
|
42
42
|
return l.setFromUnitVectors(o, r), [l.x, l.y, l.z, l.w];
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
var H, L, O;
|
|
44
|
+
function st(t, m = 0, r = 300) {
|
|
45
|
+
var H, L, O, V;
|
|
46
46
|
if (!((H = t.track) != null && H.path) || t.track.path.length === 0) {
|
|
47
|
-
const i =
|
|
47
|
+
const i = J(t.matrix), n = [
|
|
48
48
|
{
|
|
49
49
|
visible: !0,
|
|
50
50
|
timeStamp: 0 + m,
|
|
@@ -60,7 +60,7 @@ function et(t, m = 0, r = 300) {
|
|
|
60
60
|
keyframes: n
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
const o =
|
|
63
|
+
const o = J(t.matrix);
|
|
64
64
|
let l = o.quaternion.slice();
|
|
65
65
|
const p = t.track.points.find(
|
|
66
66
|
(i) => Math.abs(i.point.x - o.position[0]) < 1e-3 && Math.abs(i.point.y - o.position[1]) < 1e-3 && Math.abs(i.point.z - o.position[2]) < 1e-3
|
|
@@ -81,7 +81,8 @@ function et(t, m = 0, r = 300) {
|
|
|
81
81
|
animation: {
|
|
82
82
|
url: a ? n.animationUrl : t.animationUrl,
|
|
83
83
|
repeat: !a || (n == null ? void 0 : n.repeat),
|
|
84
|
-
needRender: a
|
|
84
|
+
needRender: a,
|
|
85
|
+
item: (L = n.subAction) != null && L.url ? n.subAction : void 0
|
|
85
86
|
}
|
|
86
87
|
}), i += n.duration * 1e3;
|
|
87
88
|
}
|
|
@@ -108,17 +109,17 @@ function et(t, m = 0, r = 300) {
|
|
|
108
109
|
repeat: h
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
|
-
let
|
|
112
|
+
let z = 0;
|
|
112
113
|
if (p) {
|
|
113
114
|
let i = 0;
|
|
114
115
|
for (const n of p.actions)
|
|
115
116
|
if (n.duration > 0 || n.animationUrl === "x_turn") {
|
|
116
117
|
if (n.animationUrl === "x_turn") {
|
|
117
118
|
n.duration = 1;
|
|
118
|
-
const a =
|
|
119
|
-
a && (l =
|
|
119
|
+
const a = W(n.rotation);
|
|
120
|
+
a && (l = D(l, a));
|
|
120
121
|
}
|
|
121
|
-
i += n.duration * 1e3,
|
|
122
|
+
i += n.duration * 1e3, z += n.duration * 1e3, u({
|
|
122
123
|
visible: !0,
|
|
123
124
|
timeStamp: i,
|
|
124
125
|
position: o.position,
|
|
@@ -131,15 +132,15 @@ function et(t, m = 0, r = 300) {
|
|
|
131
132
|
}
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
|
-
console.log(`初始action point处理完成,总延迟: ${
|
|
135
|
+
console.log(`初始action point处理完成,总延迟: ${z}ms`);
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
+
function w(i, n) {
|
|
137
138
|
return Math.sqrt(Math.pow(n.x - i.x, 2) + Math.pow(n.y - i.y, 2) + Math.pow(n.z - i.z, 2));
|
|
138
139
|
}
|
|
139
140
|
let q = 0;
|
|
140
141
|
const F = [];
|
|
141
142
|
for (let i = 0; i < t.track.path.length - 1; i++) {
|
|
142
|
-
const n =
|
|
143
|
+
const n = w(t.track.path[i], t.track.path[i + 1]);
|
|
143
144
|
F.push(n), q += n;
|
|
144
145
|
}
|
|
145
146
|
const E = q / t.track.duration;
|
|
@@ -153,12 +154,12 @@ function et(t, m = 0, r = 300) {
|
|
|
153
154
|
const n = `${i.point.x.toFixed(3)}_${i.point.y.toFixed(3)}_${i.point.z.toFixed(3)}`;
|
|
154
155
|
let a = 1 / 0, y = 0;
|
|
155
156
|
for (let f = 0; f < t.track.path.length - 1; f++) {
|
|
156
|
-
const $ =
|
|
157
|
+
const $ = k(i.point, t.track.path[f], t.track.path[f + 1]);
|
|
157
158
|
$ < a && (a = $, y = f);
|
|
158
159
|
}
|
|
159
160
|
N.set(n, y);
|
|
160
161
|
}
|
|
161
|
-
let S =
|
|
162
|
+
let S = z, j = 0;
|
|
162
163
|
const C = /* @__PURE__ */ new Set();
|
|
163
164
|
for (let i = 0; i < t.track.path.length - 1; i++) {
|
|
164
165
|
const n = t.track.path[i], a = t.track.path[i + 1], y = F[i], f = j / q * t.track.duration * 1e3;
|
|
@@ -191,15 +192,15 @@ function et(t, m = 0, r = 300) {
|
|
|
191
192
|
continue;
|
|
192
193
|
}
|
|
193
194
|
if (N.get(T) === i) {
|
|
194
|
-
const d =
|
|
195
|
+
const d = tt(s.point, n, a), M = j - y + y * d, R = M / q * t.track.duration * 1e3 + S;
|
|
195
196
|
console.log(
|
|
196
197
|
`Action点: 位置[${s.point.x.toFixed(2)}, ${s.point.y.toFixed(2)}, ${s.point.z.toFixed(
|
|
197
198
|
2
|
|
198
199
|
)}], 距离${M.toFixed(2)}, 到达时间${R.toFixed(0)}ms`
|
|
199
200
|
);
|
|
200
201
|
let I = t.animationUrl;
|
|
201
|
-
const
|
|
202
|
-
|
|
202
|
+
const b = s.actions.find((c) => c.duration > 0 && c.animationUrl !== "none"), A = b == null ? void 0 : b.subAction;
|
|
203
|
+
b ? (I = b.animationUrl, b.duration > 2, console.log(`到达动作点,使用该点的动画: ${I}`)) : console.log("动作点没有有效动作,使用默认移动动画"), u({
|
|
203
204
|
visible: !0,
|
|
204
205
|
timeStamp: R,
|
|
205
206
|
position: [s.point.x, s.point.y, s.point.z],
|
|
@@ -208,8 +209,8 @@ function et(t, m = 0, r = 300) {
|
|
|
208
209
|
animation: {
|
|
209
210
|
url: I,
|
|
210
211
|
item: A != null && A.url ? A : void 0,
|
|
211
|
-
repeat:
|
|
212
|
-
duration:
|
|
212
|
+
repeat: b == null ? void 0 : b.repeat,
|
|
213
|
+
duration: b == null ? void 0 : b.duration
|
|
213
214
|
}
|
|
214
215
|
});
|
|
215
216
|
let P = R, K = 0;
|
|
@@ -217,8 +218,8 @@ function et(t, m = 0, r = 300) {
|
|
|
217
218
|
if (c.duration > 0 || c.animationUrl === "x_turn") {
|
|
218
219
|
if (c.animationUrl === "x_turn") {
|
|
219
220
|
c.duration = 1;
|
|
220
|
-
const
|
|
221
|
-
|
|
221
|
+
const G = W(c.rotation);
|
|
222
|
+
G && (l = D(l, G));
|
|
222
223
|
}
|
|
223
224
|
const B = c.animationUrl !== "none" && c.animationUrl !== "x_turn";
|
|
224
225
|
u({
|
|
@@ -231,7 +232,7 @@ function et(t, m = 0, r = 300) {
|
|
|
231
232
|
url: B ? c.animationUrl : t.animationUrl,
|
|
232
233
|
repeat: !B || (c == null ? void 0 : c.repeat),
|
|
233
234
|
needRender: B,
|
|
234
|
-
item: (
|
|
235
|
+
item: (O = c.subAction) != null && O.url ? c.subAction : void 0,
|
|
235
236
|
duration: c == null ? void 0 : c.duration
|
|
236
237
|
}
|
|
237
238
|
}), P += c.duration * 1e3, K += c.duration * 1e3, u({
|
|
@@ -243,7 +244,7 @@ function et(t, m = 0, r = 300) {
|
|
|
243
244
|
animation: {
|
|
244
245
|
url: t.animationUrl,
|
|
245
246
|
repeat: t.repeat === "loop",
|
|
246
|
-
item: (
|
|
247
|
+
item: (V = c.subAction) != null && V.url ? c.subAction : void 0
|
|
247
248
|
}
|
|
248
249
|
});
|
|
249
250
|
}
|
|
@@ -269,16 +270,16 @@ function et(t, m = 0, r = 300) {
|
|
|
269
270
|
});
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
|
-
function
|
|
273
|
+
function k(i, n, a) {
|
|
273
274
|
const y = i.x - n.x, f = i.y - n.y, $ = i.z - n.z, U = a.x - n.x, g = a.y - n.y, s = a.z - n.z, T = y * U + f * g + $ * s, d = U * U + g * g + s * s;
|
|
274
275
|
if (d === 0)
|
|
275
276
|
return Math.sqrt(y * y + f * f + $ * $);
|
|
276
277
|
let M = T / d;
|
|
277
278
|
M < 0 ? M = 0 : M > 1 && (M = 1);
|
|
278
|
-
const
|
|
279
|
-
return Math.sqrt(
|
|
279
|
+
const v = n.x + M * U, R = n.y + M * g, I = n.z + M * s, b = i.x - v, A = i.y - R, P = i.z - I;
|
|
280
|
+
return Math.sqrt(b * b + A * A + P * P);
|
|
280
281
|
}
|
|
281
|
-
function
|
|
282
|
+
function tt(i, n, a) {
|
|
282
283
|
const y = a.x - n.x, f = a.y - n.y, $ = a.z - n.z, U = y * y + f * f + $ * $;
|
|
283
284
|
if (U === 0)
|
|
284
285
|
return 0;
|
|
@@ -296,7 +297,7 @@ function et(t, m = 0, r = 300) {
|
|
|
296
297
|
a.position[1] - n.position[1],
|
|
297
298
|
a.position[2] - n.position[2]
|
|
298
299
|
).normalize(), g = $.clone().add(U.multiplyScalar(f));
|
|
299
|
-
let s =
|
|
300
|
+
let s = et(
|
|
300
301
|
{ x: n.position[0], y: n.position[1], z: n.position[2] },
|
|
301
302
|
{ x: a.position[0], y: a.position[1], z: a.position[2] }
|
|
302
303
|
);
|
|
@@ -318,16 +319,16 @@ function et(t, m = 0, r = 300) {
|
|
|
318
319
|
if (e[d].timeStamp > n.timeStamp + r)
|
|
319
320
|
if (Math.abs(e[d].position[0] - a.position[0]) < 1e-3 && Math.abs(e[d].position[1] - a.position[1]) < 1e-3 && Math.abs(e[d].position[2] - a.position[2]) < 1e-3)
|
|
320
321
|
if (d < e.length - 1) {
|
|
321
|
-
const M = e[d].quaternion,
|
|
322
|
-
if (Math.abs(M[0] -
|
|
322
|
+
const M = e[d].quaternion, v = e[d + 1].quaternion;
|
|
323
|
+
if (Math.abs(M[0] - v[0]) + Math.abs(M[1] - v[1]) + Math.abs(M[2] - v[2]) + Math.abs(M[3] - v[3]) < 1e-3)
|
|
323
324
|
e[d].quaternion = s.slice(), console.log(`关键帧${d}没有旋转,设置为路径方向`);
|
|
324
325
|
else {
|
|
325
|
-
const I = new _.Quaternion(),
|
|
326
|
+
const I = new _.Quaternion(), b = new _.Quaternion(
|
|
326
327
|
M[0],
|
|
327
328
|
M[1],
|
|
328
329
|
M[2],
|
|
329
330
|
M[3]
|
|
330
|
-
), A = new _.Quaternion(
|
|
331
|
+
), A = new _.Quaternion(v[0], v[1], v[2], v[3]), P = b.clone();
|
|
331
332
|
P.conjugate(), I.copy(A).multiply(P), e[d].quaternion = s.slice();
|
|
332
333
|
const c = new _.Quaternion(
|
|
333
334
|
s[0],
|
|
@@ -345,7 +346,7 @@ function et(t, m = 0, r = 300) {
|
|
|
345
346
|
}
|
|
346
347
|
}
|
|
347
348
|
e.push(...X), e.sort((i, n) => i.timeStamp - n.timeStamp);
|
|
348
|
-
const Y = t.track.duration * 1e3, Z = Y + S, Q = e[e.length - 1],
|
|
349
|
+
const Y = t.track.duration * 1e3, Z = Y + S, Q = e[e.length - 1], nt = e.filter(
|
|
349
350
|
(i) => i.timeStamp === 0 && Math.abs(i.position[0] - o.position[0]) < 1e-3 && Math.abs(i.position[1] - o.position[1]) < 1e-3 && Math.abs(i.position[2] - o.position[2]) < 1e-3
|
|
350
351
|
);
|
|
351
352
|
return console.log(`动画转换完成:
|
|
@@ -356,7 +357,7 @@ function et(t, m = 0, r = 300) {
|
|
|
356
357
|
- 计算总时间: ${Z}ms (${(Z / 1e3).toFixed(2)}s)
|
|
357
358
|
- 实际最后时间戳: ${Q == null ? void 0 : Q.timeStamp}ms (${((Q == null ? void 0 : Q.timeStamp) / 1e3).toFixed(2)}s)
|
|
358
359
|
- 关键帧数量: ${e.length}
|
|
359
|
-
- 初始位置关键帧数量: ${
|
|
360
|
+
- 初始位置关键帧数量: ${nt.length}
|
|
360
361
|
- 速度一致性: ${(((Q == null ? void 0 : Q.timeStamp) - S) / 1e3 / t.track.duration * 100).toFixed(1)}% (100%为完全一致)`), {
|
|
361
362
|
id: t.id,
|
|
362
363
|
name: t.name || "默认角色",
|
|
@@ -366,5 +367,5 @@ function et(t, m = 0, r = 300) {
|
|
|
366
367
|
};
|
|
367
368
|
}
|
|
368
369
|
export {
|
|
369
|
-
|
|
370
|
+
st as convertMockToPlayer
|
|
370
371
|
};
|
package/libs/base/BasePlugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function A() {
|
|
2
2
|
console.debug(
|
|
3
|
-
"%c %c@realsee/dnalogel %cv3.77.4-alpha.
|
|
3
|
+
"%c %c@realsee/dnalogel %cv3.77.4-alpha.4",
|
|
4
4
|
[
|
|
5
5
|
"background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')",
|
|
6
6
|
"background-repeat: no-repeat",
|