@realsee/dnalogel 3.77.4-alpha.2 → 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/DigitalPerformancePlugin/core/DigitalHuman.d.ts +1 -0
- package/dist/index.cjs.js +42 -42
- package/dist/index.js +4366 -4364
- package/dist/index.umd.js +43 -43
- package/libs/DigitalPerformancePlugin/core/DigitalHuman.d.ts +1 -0
- package/libs/DigitalPerformancePlugin/core/DigitalHuman.js +23 -22
- package/libs/DigitalPerformancePlugin/mock.js +53 -52
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var n = (
|
|
4
|
-
var M = (
|
|
1
|
+
var B = Object.defineProperty;
|
|
2
|
+
var x = (p, e, t) => e in p ? B(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t;
|
|
3
|
+
var n = (p, e, t) => (x(p, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
var M = (p, e, t) => new Promise((l, o) => {
|
|
5
5
|
var a = (d) => {
|
|
6
6
|
try {
|
|
7
|
-
|
|
7
|
+
y(t.next(d));
|
|
8
8
|
} catch (F) {
|
|
9
9
|
o(F);
|
|
10
10
|
}
|
|
11
11
|
}, g = (d) => {
|
|
12
12
|
try {
|
|
13
|
-
|
|
13
|
+
y(t.throw(d));
|
|
14
14
|
} catch (F) {
|
|
15
15
|
o(F);
|
|
16
16
|
}
|
|
17
|
-
},
|
|
18
|
-
|
|
17
|
+
}, y = (d) => d.done ? l(d.value) : Promise.resolve(d.value).then(a, g);
|
|
18
|
+
y((t = t.apply(p, e)).next());
|
|
19
19
|
});
|
|
20
20
|
import * as i from "three";
|
|
21
|
-
import { DigitalStateMachine as
|
|
22
|
-
import { Trace as
|
|
21
|
+
import { DigitalStateMachine as L } from "./DigitalStateMachine.js";
|
|
22
|
+
import { Trace as S } from "./Trace.js";
|
|
23
23
|
const q = 300;
|
|
24
24
|
class D {
|
|
25
25
|
constructor(e, t) {
|
|
@@ -45,17 +45,18 @@ class D {
|
|
|
45
45
|
n(this, "attachedItems", /* @__PURE__ */ new Map());
|
|
46
46
|
// 缓存 RightHand 骨骼
|
|
47
47
|
n(this, "rightHandBone", null);
|
|
48
|
-
this.model = e, this.model.visible = !1, this.model.mixer = null, this.mixer = new i.AnimationMixer(this.model), this.action = null, this.keyframesManager = new
|
|
48
|
+
this.model = e, this.model.visible = !1, this.model.mixer = null, this.mixer = new i.AnimationMixer(this.model), this.action = null, this.keyframesManager = new L(), this.keyframes = [], this.items = [], this.effects = [], this.digitalPlayground = t, this.state = {
|
|
49
49
|
currentTime: 0,
|
|
50
50
|
currentAnimation: null,
|
|
51
|
+
currentAnimationRepeat: !1,
|
|
51
52
|
playing: !1
|
|
52
|
-
}, this.animationFrameId = null, this.itemMatrixMap = /* @__PURE__ */ new Map(), this.trace = new
|
|
53
|
+
}, this.animationFrameId = null, this.itemMatrixMap = /* @__PURE__ */ new Map(), this.trace = new S(), this.curveLine = new i.Line(), this.curveLine.material = new i.LineBasicMaterial({ color: 14467195, linewidth: 5 }), this.effectsGroup = new i.Group(), this.effectObjects = /* @__PURE__ */ new Map(), this.container = new i.Group(), this.container.add(this.model), this.container.add(this.curveLine), this.container.add(this.effectsGroup);
|
|
53
54
|
}
|
|
54
55
|
playAnimation({ animation: e, repeat: t, switchDuration: l }) {
|
|
55
56
|
const o = this.action;
|
|
56
57
|
e.tracks = e.tracks.filter((g) => g);
|
|
57
58
|
const a = this.mixer.clipAction(e);
|
|
58
|
-
a.reset(), t
|
|
59
|
+
a.reset(), t ? (a.setLoop(i.LoopRepeat, 1 / 0), a.clampWhenFinished = !1) : (a.setLoop(i.LoopOnce, 1), a.clampWhenFinished = !0), o && (a.enabled = !0, a.setEffectiveTimeScale(1), a.crossFadeFrom(o, l / 1e3, !0)), a.play(), o && o !== a && setTimeout(() => {
|
|
59
60
|
o.stop();
|
|
60
61
|
}, l), this.action = a;
|
|
61
62
|
}
|
|
@@ -80,9 +81,9 @@ class D {
|
|
|
80
81
|
return M(this, null, function* () {
|
|
81
82
|
this.clearProcessedNeedRenderKeyframeIndices();
|
|
82
83
|
const { keyframes: t, items: l, effects: o } = e || {};
|
|
83
|
-
return this.keyframes = t || this.keyframes, this.items = l || this.items, this.effects = o || this.effects, this.state.currentAnimation = null, this.state.playing = !0, new Promise((a, g) => {
|
|
84
|
+
return this.keyframes = t || this.keyframes, this.items = l || this.items, this.effects = o || this.effects, this.state.currentAnimation = null, this.state.currentAnimationRepeat = !1, this.state.playing = !0, new Promise((a, g) => {
|
|
84
85
|
this.state.currentTime || this.init();
|
|
85
|
-
let
|
|
86
|
+
let y = null;
|
|
86
87
|
for (let c = 0; c < this.items.length; c++) {
|
|
87
88
|
const h = this.digitalPlayground.getDigitalItem(this.items[c].model);
|
|
88
89
|
if (h) {
|
|
@@ -112,9 +113,9 @@ class D {
|
|
|
112
113
|
}
|
|
113
114
|
const v = (c) => {
|
|
114
115
|
var A, w;
|
|
115
|
-
|
|
116
|
-
const h = c -
|
|
117
|
-
|
|
116
|
+
y === null && (y = c);
|
|
117
|
+
const h = c - y;
|
|
118
|
+
y = c, this.state.currentTime += h;
|
|
118
119
|
const s = this.keyframesManager.getStateByTime(this.state.currentTime, this.keyframes, "model");
|
|
119
120
|
this.trace.addPoint(s.translation);
|
|
120
121
|
const u = new i.BufferGeometry().setFromPoints(this.trace.tracePoints);
|
|
@@ -122,8 +123,8 @@ class D {
|
|
|
122
123
|
this.model.visible = !1, this.container.visible = !1, this.stopAnimation(), this.model.needsRender = !0, a(!0), this.animationFrameId !== null && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null);
|
|
123
124
|
return;
|
|
124
125
|
} else if (s.animation) {
|
|
125
|
-
const r = this.digitalPlayground.getAnimation(s.animation.url), m = s.animation.needRender;
|
|
126
|
-
(r !== this.state.currentAnimation || m && !this.hasProcessedNeedRenderForTimestamp(s.keyframeIndex)) && (m && r === this.state.currentAnimation && this.markNeedRenderProcessedForTimestamp(s.keyframeIndex), this.state.currentAnimation = r, this.playAnimation({
|
|
126
|
+
const r = this.digitalPlayground.getAnimation(s.animation.url), m = s.animation.needRender, I = s.animation.repeat !== this.state.currentAnimationRepeat;
|
|
127
|
+
(r !== this.state.currentAnimation || I || m && !this.hasProcessedNeedRenderForTimestamp(s.keyframeIndex)) && (m && r === this.state.currentAnimation && this.markNeedRenderProcessedForTimestamp(s.keyframeIndex), this.state.currentAnimation = r, this.state.currentAnimationRepeat = s.animation.repeat, this.playAnimation({
|
|
127
128
|
animation: r,
|
|
128
129
|
repeat: s.animation.repeat,
|
|
129
130
|
switchDuration: (A = s.animation.switchDuration) != null ? A : q
|
|
@@ -139,9 +140,9 @@ class D {
|
|
|
139
140
|
if (m.type === "frameSequence") {
|
|
140
141
|
const I = m.type + r;
|
|
141
142
|
if (!this.effectObjects.has(I)) {
|
|
142
|
-
const
|
|
143
|
+
const R = new i.PlaneGeometry(1, 1), b = new i.MeshBasicMaterial({
|
|
143
144
|
transparent: !0
|
|
144
|
-
}), k = new i.Mesh(
|
|
145
|
+
}), k = new i.Mesh(R, b);
|
|
145
146
|
k.rotateX(-Math.PI / 2), k.position.copy(new i.Vector3().fromArray(m.position)), this.effectObjects.set(I, k), this.effectsGroup.add(k);
|
|
146
147
|
}
|
|
147
148
|
const f = this.effectObjects.get(I), T = this.keyframesManager.getStateByTime(this.state.currentTime, this.effects[r].keyframes, "effect"), P = d.get(T.image);
|
|
@@ -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
|
|
@@ -80,8 +80,9 @@ function et(t, m = 0, r = 300) {
|
|
|
80
80
|
scale: o.scale,
|
|
81
81
|
animation: {
|
|
82
82
|
url: a ? n.animationUrl : t.animationUrl,
|
|
83
|
-
repeat: !a
|
|
84
|
-
needRender: a
|
|
83
|
+
repeat: !a || (n == null ? void 0 : n.repeat),
|
|
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",
|