@realsee/dnalogel 3.80.2 → 3.80.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/CHANGELOG.md +8 -0
- package/dist/index.cjs.js +47 -47
- package/dist/index.js +3614 -3596
- package/dist/index.umd.js +45 -45
- package/libs/DigitalPerformancePlugin/core/DigitalHuman.js +73 -75
- package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +325 -305
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var n = (p, e, t) => (
|
|
4
|
-
var
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var B = (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) => (B(p, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
var T = (p, e, t) => new Promise((c, o) => {
|
|
5
5
|
var s = (d) => {
|
|
6
6
|
try {
|
|
7
|
-
|
|
8
|
-
} catch (
|
|
9
|
-
o(
|
|
7
|
+
g(t.next(d));
|
|
8
|
+
} catch (A) {
|
|
9
|
+
o(A);
|
|
10
10
|
}
|
|
11
|
-
},
|
|
11
|
+
}, f = (d) => {
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
} catch (
|
|
15
|
-
o(
|
|
13
|
+
g(t.throw(d));
|
|
14
|
+
} catch (A) {
|
|
15
|
+
o(A);
|
|
16
16
|
}
|
|
17
|
-
},
|
|
18
|
-
|
|
17
|
+
}, g = (d) => d.done ? c(d.value) : Promise.resolve(d.value).then(s, f);
|
|
18
|
+
g((t = t.apply(p, e)).next());
|
|
19
19
|
});
|
|
20
20
|
import * as i from "three";
|
|
21
|
-
import { DigitalStateMachine as
|
|
22
|
-
import { Trace as
|
|
23
|
-
const
|
|
24
|
-
class
|
|
21
|
+
import { DigitalStateMachine as x } from "./DigitalStateMachine.js";
|
|
22
|
+
import { Trace as L } from "./Trace.js";
|
|
23
|
+
const S = 300;
|
|
24
|
+
class G {
|
|
25
25
|
constructor(e, t) {
|
|
26
26
|
n(this, "model");
|
|
27
27
|
n(this, "keyframesManager");
|
|
@@ -45,18 +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 x(), this.keyframes = [], this.items = [], this.effects = [], this.digitalPlayground = t, this.state = {
|
|
49
49
|
currentTime: 0,
|
|
50
50
|
currentAnimation: null,
|
|
51
51
|
currentAnimationRepeat: !1,
|
|
52
52
|
playing: !1
|
|
53
|
-
}, this.animationFrameId = null, this.itemMatrixMap = /* @__PURE__ */ new Map(), this.trace = new
|
|
53
|
+
}, this.animationFrameId = null, this.itemMatrixMap = /* @__PURE__ */ new Map(), this.trace = new L(), 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);
|
|
54
54
|
}
|
|
55
|
-
playAnimation({ animation: e, repeat: t, switchDuration:
|
|
55
|
+
playAnimation({ animation: e, repeat: t, switchDuration: c }) {
|
|
56
56
|
const o = this.action, s = this.mixer.clipAction(e);
|
|
57
|
-
s.reset(), t ? (s.setLoop(i.LoopRepeat, 1 / 0), s.clampWhenFinished = !1) : (s.setLoop(i.LoopOnce, 1), s.clampWhenFinished = !0), o && (s.enabled = !0, s.setEffectiveTimeScale(1), s.crossFadeFrom(o,
|
|
58
|
-
o.stop();
|
|
59
|
-
},
|
|
57
|
+
s.reset(), t ? (s.setLoop(i.LoopRepeat, 1 / 0), s.clampWhenFinished = !1) : (s.setLoop(i.LoopOnce, 1), s.clampWhenFinished = !0), o && (s.enabled = !0, s.setEffectiveTimeScale(1), s.crossFadeFrom(o, c / 1e3, !0)), s.play(), o && o !== s && setTimeout(() => {
|
|
58
|
+
o !== this.action && o.stop();
|
|
59
|
+
}, c), this.action = s;
|
|
60
60
|
}
|
|
61
61
|
pauseAnimation() {
|
|
62
62
|
this.action && (this.action.paused = !0), this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null), this.state.playing = !1;
|
|
@@ -76,80 +76,78 @@ class D {
|
|
|
76
76
|
this.state.currentTime = 0, this.keyframes && this.keyframes.length > 0 && (this.model.position.copy(new i.Vector3().fromArray(this.keyframes[0].position)), this.model.quaternion.copy(new i.Quaternion().fromArray(this.keyframes[0].quaternion))), this.model.visible = !1, this.container.visible = !1, this.animationFrameId && cancelAnimationFrame(this.animationFrameId), this.stopAnimation(), this.clearTrace(), this.detachAllKeyframeItems(), this.state.playing = !1;
|
|
77
77
|
}
|
|
78
78
|
play(e) {
|
|
79
|
-
return
|
|
79
|
+
return T(this, null, function* () {
|
|
80
80
|
this.clearProcessedNeedRenderKeyframeIndices();
|
|
81
|
-
const { keyframes: t, items:
|
|
82
|
-
return this.keyframes = t || this.keyframes, this.items =
|
|
81
|
+
const { keyframes: t, items: c, effects: o } = e || {};
|
|
82
|
+
return this.keyframes = t || this.keyframes, this.items = c || this.items, this.effects = o || this.effects, this.state.currentAnimation = null, this.state.currentAnimationRepeat = !1, this.state.playing = !0, new Promise((s) => {
|
|
83
83
|
this.state.currentTime || this.init();
|
|
84
|
-
let
|
|
85
|
-
for (
|
|
86
|
-
const h = this.digitalPlayground.getDigitalItem(
|
|
84
|
+
let f = null;
|
|
85
|
+
for (const u of this.items) {
|
|
86
|
+
const h = this.digitalPlayground.getDigitalItem(u.model);
|
|
87
87
|
if (h) {
|
|
88
88
|
let a = null;
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
89
|
+
const I = this.model.children[0].children.find((l) => l instanceof i.Bone), w = this.model.children[0].children.find((l) => l instanceof i.SkinnedMesh);
|
|
90
|
+
if (!I || !w)
|
|
91
91
|
throw new Error("模型骨骼缺失");
|
|
92
|
-
if (this.model.children[0].children[2].traverse((
|
|
93
|
-
|
|
92
|
+
if (this.model.children[0].children[2].traverse((l) => {
|
|
93
|
+
l instanceof i.Bone && l.name === "RightHand" && (a = l);
|
|
94
94
|
}), !a)
|
|
95
95
|
throw new Error("没有找到绑定的骨骼");
|
|
96
96
|
a.add(h);
|
|
97
|
-
const
|
|
98
|
-
new i.Matrix4().fromArray(
|
|
97
|
+
const F = new i.Vector3(), r = new i.Quaternion(), m = new i.Vector3();
|
|
98
|
+
new i.Matrix4().fromArray(u.initialMatrix).decompose(F, r, m), h.position.copy(F), h.quaternion.copy(r), h.scale.copy(m), h.updateMatrixWorld(!0);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
const
|
|
102
|
-
for (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const a
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
g.name = a[u].image, d.set(a[u].image, g);
|
|
101
|
+
const g = /* @__PURE__ */ new Map(), d = new i.TextureLoader();
|
|
102
|
+
for (const u of this.effects)
|
|
103
|
+
if (u.type === "frameSequence") {
|
|
104
|
+
const h = u.keyframes;
|
|
105
|
+
for (const a of h)
|
|
106
|
+
d.load(a.image, (I) => {
|
|
107
|
+
I.name = a.image, g.set(a.image, I);
|
|
109
108
|
});
|
|
110
109
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
y = c, this.state.currentTime += h;
|
|
110
|
+
const A = (u) => {
|
|
111
|
+
var w, F;
|
|
112
|
+
f === null && (f = u);
|
|
113
|
+
const h = u - f;
|
|
114
|
+
f = u, this.state.currentTime += h;
|
|
117
115
|
const a = this.keyframesManager.getStateByTime(this.state.currentTime, this.keyframes, "model");
|
|
118
116
|
this.trace.addPoint(a.translation);
|
|
119
|
-
const
|
|
120
|
-
if (this.curveLine.geometry =
|
|
117
|
+
const I = new i.BufferGeometry().setFromPoints(this.trace.tracePoints);
|
|
118
|
+
if (this.curveLine.geometry = I, this.model.position.copy(a.translation), this.model.quaternion.copy(a.quaternion), this.model.scale.copy(a.scale), this.model.visible = a.visible, a.isFinal) {
|
|
121
119
|
this.model.visible = !1, this.container.visible = !1, this.stopAnimation(), this.model.needsRender = !0, s(!0), this.animationFrameId !== null && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null);
|
|
122
120
|
return;
|
|
123
121
|
} else if (a.animation) {
|
|
124
|
-
const r = this.digitalPlayground.getAnimation(a.animation.url), m = a.animation.needRender,
|
|
125
|
-
(r !== this.state.currentAnimation ||
|
|
122
|
+
const r = this.digitalPlayground.getAnimation(a.animation.url), m = a.animation.needRender, y = a.animation.repeat !== this.state.currentAnimationRepeat;
|
|
123
|
+
(r !== this.state.currentAnimation || y || m && !this.hasProcessedNeedRenderForTimestamp(a.keyframeIndex)) && (m && r === this.state.currentAnimation && this.markNeedRenderProcessedForTimestamp(a.keyframeIndex), this.state.currentAnimation = r, this.state.currentAnimationRepeat = a.animation.repeat, this.playAnimation({
|
|
126
124
|
animation: r,
|
|
127
125
|
repeat: a.animation.repeat,
|
|
128
|
-
switchDuration: (
|
|
126
|
+
switchDuration: (w = a.animation.switchDuration) != null ? w : S
|
|
129
127
|
})), this.mixer.update(h / 1e3), a.animation.isOver === !0 && (this.action.paused = !0, this.action.time = this.state.currentAnimation.duration, this.mixer.update(0));
|
|
130
128
|
}
|
|
131
|
-
this.updateKeyframeItems((
|
|
132
|
-
for (
|
|
133
|
-
const m = this.digitalPlayground.getDigitalItem(
|
|
134
|
-
m && (this.keyframesManager.getStateByTime(this.state.currentTime,
|
|
129
|
+
this.updateKeyframeItems((F = a.animation) == null ? void 0 : F.item);
|
|
130
|
+
for (const r of this.items) {
|
|
131
|
+
const m = this.digitalPlayground.getDigitalItem(r.model);
|
|
132
|
+
m && (this.keyframesManager.getStateByTime(this.state.currentTime, r.keyframes, "item").visible === !0 ? m.visible = !0 : m.visible = !1);
|
|
135
133
|
}
|
|
136
134
|
for (let r = 0; r < this.effects.length; r++) {
|
|
137
135
|
const m = this.effects[r];
|
|
138
136
|
if (m.type === "frameSequence") {
|
|
139
|
-
const
|
|
140
|
-
if (!this.effectObjects.has(
|
|
141
|
-
const
|
|
137
|
+
const y = m.type + r;
|
|
138
|
+
if (!this.effectObjects.has(y)) {
|
|
139
|
+
const P = new i.PlaneGeometry(1, 1), R = new i.MeshBasicMaterial({
|
|
142
140
|
transparent: !0
|
|
143
|
-
}), k = new i.Mesh(
|
|
144
|
-
k.rotateX(-Math.PI / 2), k.position.copy(new i.Vector3().fromArray(m.position)), this.effectObjects.set(
|
|
141
|
+
}), k = new i.Mesh(P, R);
|
|
142
|
+
k.rotateX(-Math.PI / 2), k.position.copy(new i.Vector3().fromArray(m.position)), this.effectObjects.set(y, k), this.effectsGroup.add(k);
|
|
145
143
|
}
|
|
146
|
-
const
|
|
147
|
-
|
|
144
|
+
const l = this.effectObjects.get(y), v = this.keyframesManager.getStateByTime(this.state.currentTime, this.effects[r].keyframes, "effect"), M = g.get(v.image);
|
|
145
|
+
l.material.map = M, l.visible = v.visible;
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
|
-
this.model.needsRender = !0, this.animationFrameId = requestAnimationFrame(
|
|
148
|
+
this.model.needsRender = !0, this.animationFrameId = requestAnimationFrame(A);
|
|
151
149
|
};
|
|
152
|
-
this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null), this.animationFrameId = requestAnimationFrame(
|
|
150
|
+
this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null), this.animationFrameId = requestAnimationFrame(A);
|
|
153
151
|
});
|
|
154
152
|
});
|
|
155
153
|
}
|
|
@@ -159,8 +157,8 @@ class D {
|
|
|
159
157
|
for (let e = 0; e <= this.state.currentTime; e += 100) {
|
|
160
158
|
const t = this.keyframesManager.getStateByTime(e, this.keyframes, "model");
|
|
161
159
|
this.trace.addPoint(t.translation);
|
|
162
|
-
const
|
|
163
|
-
this.curveLine.geometry =
|
|
160
|
+
const c = new i.BufferGeometry().setFromPoints(this.trace.tracePoints);
|
|
161
|
+
this.curveLine.geometry = c;
|
|
164
162
|
}
|
|
165
163
|
}
|
|
166
164
|
// 清楚轨迹
|
|
@@ -192,14 +190,14 @@ class D {
|
|
|
192
190
|
updateKeyframeItems(e) {
|
|
193
191
|
var o;
|
|
194
192
|
const t = (e == null ? void 0 : e.url) || null;
|
|
195
|
-
for (const [s,
|
|
196
|
-
t !== s && ((o =
|
|
193
|
+
for (const [s, f] of this.attachedItems)
|
|
194
|
+
t !== s && ((o = f.parent) == null || o.remove(f), this.attachedItems.delete(s));
|
|
197
195
|
if (!t)
|
|
198
196
|
return;
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
197
|
+
const c = this.getRightHandBone();
|
|
198
|
+
if (c && !this.attachedItems.has(t)) {
|
|
201
199
|
const s = this.digitalPlayground.getDigitalItem(t);
|
|
202
|
-
s && (
|
|
200
|
+
s && (c.add(s), this.attachedItems.set(t, s));
|
|
203
201
|
}
|
|
204
202
|
}
|
|
205
203
|
// 解绑所有 keyframe 道具
|
|
@@ -211,5 +209,5 @@ class D {
|
|
|
211
209
|
}
|
|
212
210
|
}
|
|
213
211
|
export {
|
|
214
|
-
|
|
212
|
+
G as DigitalHuman
|
|
215
213
|
};
|