@chatlychat/world 0.1.0 → 0.2.0
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 +11 -0
- package/README.md +70 -6
- package/dist/agent.d.ts +5 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +22 -3
- package/dist/agent.js.map +1 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +11 -0
- package/dist/capabilities.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/model.d.ts +34 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +35 -9
- package/dist/model.js.map +1 -1
- package/dist/picks.d.ts +45 -0
- package/dist/picks.d.ts.map +1 -0
- package/dist/picks.js +186 -0
- package/dist/picks.js.map +1 -0
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vrm.d.ts +97 -0
- package/dist/vrm.d.ts.map +1 -0
- package/dist/vrm.js +212 -0
- package/dist/vrm.js.map +1 -0
- package/dist/world.d.ts.map +1 -1
- package/dist/world.js +28 -187
- package/dist/world.js.map +1 -1
- package/package.json +13 -5
- package/dist/examples/tsconfig.tsbuildinfo +0 -1
package/dist/picks.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
import { buildGrid, cardKey, defaultCard, readCard } from './cards.js';
|
|
3
|
+
import { cardActions, makeHandlers } from './handlers.js';
|
|
4
|
+
import { interactive } from './input.js';
|
|
5
|
+
import { GRID_PLACEMENTS } from './layout.js';
|
|
6
|
+
import { enter, setOpacity } from './motion.js';
|
|
7
|
+
import { WORLD_CONTRACT } from './types.js';
|
|
8
|
+
export const named = (node, name) => {
|
|
9
|
+
node.name = node.name === '' ? name : node.name;
|
|
10
|
+
return node;
|
|
11
|
+
};
|
|
12
|
+
export function createPicks(deps) {
|
|
13
|
+
const { conversation, camera, renderers: r, anchors, theme, reduced, placement, root, motion, selection, hooks, loadModel, onError, sound, } = deps;
|
|
14
|
+
let grid = null;
|
|
15
|
+
let held = null;
|
|
16
|
+
const drawCard = (g, index) => {
|
|
17
|
+
const block = g.cards[index];
|
|
18
|
+
const key = cardKey(g.message, block, index);
|
|
19
|
+
const data = readCard(block);
|
|
20
|
+
const props = {
|
|
21
|
+
theme: theme(),
|
|
22
|
+
placement,
|
|
23
|
+
reducedMotion: reduced(),
|
|
24
|
+
block: { type: 'card', ...block },
|
|
25
|
+
message: g.message,
|
|
26
|
+
selected: selection.id === key,
|
|
27
|
+
...makeHandlers(conversation, g.message, data.title, cardActions(block), hooks),
|
|
28
|
+
};
|
|
29
|
+
const node = named(r?.renderCard !== undefined
|
|
30
|
+
? r.renderCard(props)
|
|
31
|
+
: defaultCard(props, { loadModel, onError }), WORLD_CONTRACT.objects.card);
|
|
32
|
+
node.userData['cardKey'] = key;
|
|
33
|
+
if (node.userData['cl3Handled'] !== true) {
|
|
34
|
+
interactive(node, 'card', () => void toggle(key));
|
|
35
|
+
}
|
|
36
|
+
return node;
|
|
37
|
+
};
|
|
38
|
+
const redraw = (key) => {
|
|
39
|
+
const e = key === null ? undefined : grid?.nodes.get(key);
|
|
40
|
+
if (grid === null || e === undefined) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const next = drawCard(grid, e.index);
|
|
44
|
+
next.position.copy(e.node.position);
|
|
45
|
+
next.rotation.copy(e.node.rotation);
|
|
46
|
+
const parent = e.node.parent;
|
|
47
|
+
if (parent !== null) {
|
|
48
|
+
// Same slot in the child list, so traversal order stays the card order.
|
|
49
|
+
parent.children.splice(parent.children.indexOf(e.node), 1, next);
|
|
50
|
+
next.parent = parent;
|
|
51
|
+
e.node.parent = null;
|
|
52
|
+
}
|
|
53
|
+
grid.nodes.set(key, { node: next, index: e.index });
|
|
54
|
+
};
|
|
55
|
+
const dropHeld = () => {
|
|
56
|
+
held?.removeFromParent();
|
|
57
|
+
held = null;
|
|
58
|
+
};
|
|
59
|
+
const showHeld = (key) => {
|
|
60
|
+
dropHeld();
|
|
61
|
+
if (grid === null) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const index = grid.nodes.get(key)?.index ?? 0;
|
|
65
|
+
const block = grid.cards[index];
|
|
66
|
+
const data = readCard(block);
|
|
67
|
+
const props = {
|
|
68
|
+
theme: theme(),
|
|
69
|
+
placement,
|
|
70
|
+
reducedMotion: reduced(),
|
|
71
|
+
block: { type: 'card', ...block },
|
|
72
|
+
message: grid.message,
|
|
73
|
+
release: () => release(),
|
|
74
|
+
...makeHandlers(conversation, grid.message, data.title, cardActions(block), hooks),
|
|
75
|
+
};
|
|
76
|
+
const node = r?.renderPick !== undefined
|
|
77
|
+
? r.renderPick(props)
|
|
78
|
+
: (() => {
|
|
79
|
+
const n = defaultCard({ ...props, selected: true }, { loadModel, onError });
|
|
80
|
+
n.name = WORLD_CONTRACT.objects.pick;
|
|
81
|
+
n.scale.setScalar(0.6);
|
|
82
|
+
return n;
|
|
83
|
+
})();
|
|
84
|
+
named(node, WORLD_CONTRACT.objects.pick);
|
|
85
|
+
if (node.userData['cl3Handled'] !== true) {
|
|
86
|
+
interactive(node, 'release', release);
|
|
87
|
+
}
|
|
88
|
+
if (anchors.hand !== undefined && anchors.hand !== null) {
|
|
89
|
+
anchors.hand.add(node);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// Placed once, in front of where the visitor is looking — not carried on the head.
|
|
93
|
+
const dir = camera.getWorldDirection(new Vector3());
|
|
94
|
+
const at = camera.getWorldPosition(new Vector3()).addScaledVector(dir, 0.6);
|
|
95
|
+
at.y -= 0.25;
|
|
96
|
+
root.add(node);
|
|
97
|
+
node.position.copy(root.worldToLocal(at));
|
|
98
|
+
}
|
|
99
|
+
const y = node.position.y;
|
|
100
|
+
const k = theme().motionPick;
|
|
101
|
+
motion.run(k === 'none' ? 0 : 250, (t) => {
|
|
102
|
+
if (k === 'rise') {
|
|
103
|
+
node.position.y = y - 0.15 * (1 - t);
|
|
104
|
+
}
|
|
105
|
+
else if (k === 'drop') {
|
|
106
|
+
node.position.y = y + 0.15 * (1 - t);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
setOpacity(node, t);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
held = node;
|
|
113
|
+
};
|
|
114
|
+
const select = async (key) => {
|
|
115
|
+
const e = grid?.nodes.get(key);
|
|
116
|
+
if (grid === null || e === undefined || selection.id === key) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const prev = selection.id;
|
|
120
|
+
const block = grid.cards[e.index];
|
|
121
|
+
selection.set(key);
|
|
122
|
+
redraw(prev);
|
|
123
|
+
redraw(key);
|
|
124
|
+
showHeld(key);
|
|
125
|
+
sound('pick', e.node);
|
|
126
|
+
try {
|
|
127
|
+
await makeHandlers(conversation, grid.message, readCard(block).title, [], hooks).select({
|
|
128
|
+
type: 'card.select',
|
|
129
|
+
card: typeof block['id'] === 'string' ? block['id'] : `c${String(e.index)}`,
|
|
130
|
+
message: grid.message.id,
|
|
131
|
+
});
|
|
132
|
+
sound('select', e.node);
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
// The thread never heard about it, so the world must not claim it was picked.
|
|
136
|
+
if (selection.id === key) {
|
|
137
|
+
release();
|
|
138
|
+
}
|
|
139
|
+
onError(err);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
function release() {
|
|
143
|
+
const prev = selection.id;
|
|
144
|
+
selection.set(null);
|
|
145
|
+
redraw(prev);
|
|
146
|
+
dropHeld();
|
|
147
|
+
}
|
|
148
|
+
const toggle = (key) => {
|
|
149
|
+
if (selection.id === key) {
|
|
150
|
+
release();
|
|
151
|
+
return Promise.resolve();
|
|
152
|
+
}
|
|
153
|
+
return select(key);
|
|
154
|
+
};
|
|
155
|
+
const showGrid = (message) => {
|
|
156
|
+
const blocks = message.blocks?.blocks ?? [];
|
|
157
|
+
const block = [...blocks].reverse().find((b) => b.type === 'card_grid' || b.type === 'card');
|
|
158
|
+
grid?.group.removeFromParent();
|
|
159
|
+
release();
|
|
160
|
+
grid = null;
|
|
161
|
+
if (block === undefined) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const cards = block.type === 'card'
|
|
165
|
+
? [block]
|
|
166
|
+
: (block['cards'] ?? []);
|
|
167
|
+
const want = block['placement'];
|
|
168
|
+
const kind = GRID_PLACEMENTS.includes(want)
|
|
169
|
+
? want
|
|
170
|
+
: 'arc';
|
|
171
|
+
const draft = { message, cards };
|
|
172
|
+
const built = buildGrid(kind, cards.length, theme(), (i) => drawCard(draft, i), (i) => cardKey(message, cards[i], i));
|
|
173
|
+
grid = Object.assign(built, { message, cards });
|
|
174
|
+
// Spawned where the viewer stands and faces now; then left alone.
|
|
175
|
+
const cam = camera.getWorldPosition(new Vector3());
|
|
176
|
+
const dir = camera.getWorldDirection(new Vector3());
|
|
177
|
+
built.group.position.copy(root.worldToLocal(cam));
|
|
178
|
+
built.group.rotation.y = Math.atan2(-dir.x, -dir.z);
|
|
179
|
+
root.add(built.group);
|
|
180
|
+
for (const { node } of built.nodes.values()) {
|
|
181
|
+
enter(motion, node, theme().motionEntrance);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
return { grid: () => grid, select, release, showGrid };
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=picks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picks.js","sourceRoot":"","sources":["../src/picks.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAiB,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAqB,MAAM,eAAe,CAA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C,EACzB,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAA4B,EAAE,CAAC,CAAC,CAChE,CAAC;QACF,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAChD,kEAAkE;QAClE,MAAM,GAAG,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;QACpD,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACtB,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5C,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACzD,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* names and version.
|
|
4
4
|
*/
|
|
5
5
|
import type { ModelLoader } from './model.js';
|
|
6
|
+
import type { VrmModuleLoader } from './vrm.js';
|
|
6
7
|
import type { AgentWorldPresence, Conversation, PresenceMap, WorldHostAbilities, WorldPlacementRequest, WorldRenderers, WorldTheme } from '@chatlychat/core';
|
|
7
8
|
import type { Camera, Object3D, Vector3 } from 'three';
|
|
8
9
|
/**
|
|
@@ -35,7 +36,7 @@ export type WorldNodeRenderers = WorldRenderers<Object3D> & {
|
|
|
35
36
|
/** Pin the contract version these renderers were written against. */
|
|
36
37
|
readonly contract?: number;
|
|
37
38
|
};
|
|
38
|
-
export type WorldErrorCode = 'unsupported_contract' | 'disposed' | 'unknown_action' | 'unsupported_format';
|
|
39
|
+
export type WorldErrorCode = 'unsupported_contract' | 'disposed' | 'unknown_action' | 'unsupported_format' | 'missing_peer';
|
|
39
40
|
export declare class WorldError extends Error {
|
|
40
41
|
readonly code: WorldErrorCode;
|
|
41
42
|
constructor(code: WorldErrorCode, message: string);
|
|
@@ -86,6 +87,11 @@ export interface WorldOptions {
|
|
|
86
87
|
readonly anchors?: WorldAnchors;
|
|
87
88
|
readonly renderers?: WorldNodeRenderers;
|
|
88
89
|
readonly loadModel?: ModelLoader;
|
|
90
|
+
/**
|
|
91
|
+
* Only for VRM avatars, and only if you bundle: `() => import('@pixiv/three-vrm')`.
|
|
92
|
+
* `@pixiv/three-vrm` is an optional peer dependency; a glTF-only host never needs it.
|
|
93
|
+
*/
|
|
94
|
+
readonly loadVrm?: VrmModuleLoader;
|
|
89
95
|
readonly onSound?: (cue: SoundCue) => void;
|
|
90
96
|
/** Polite live-region text: the agent's state, new messages, an action's equivalent. */
|
|
91
97
|
readonly announce?: (text: string) => void;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,UAAU,EACX,MAAM,kBAAkB,CAA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AAmE;IACnE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;IACxF,sDAAsD;IACtD,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,CAAC;IACV,SAAS,EAAE;QACT,YAAY;QACZ,YAAY;QACZ,cAAc;QACd,aAAa;QACb,gBAAgB;QAChB,aAAa;KACd;IACD,OAAO,EAAE;QACP,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,YAAY;QACpB,MAAM,EAAE,YAAY;QACpB,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,cAAc;QACxB,KAAK,EAAE,WAAW;KACnB;CACO,CAAC;AAgBX,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnB,IAAI,CAAiB;IAErC,YAAmB,IAAoB,EAAE,OAAe;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/vrm.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VRM avatars — the optional half of the agent's body.
|
|
3
|
+
*
|
|
4
|
+
* `@pixiv/three-vrm` is an OPTIONAL peer dependency. This file never imports
|
|
5
|
+
* it statically, and the dynamic import below names it through a computed
|
|
6
|
+
* specifier, so no bundler resolves it while building a glTF-only host: that
|
|
7
|
+
* host neither installs it nor ships a byte of it. A host that does use VRM
|
|
8
|
+
* installs it and, if it bundles, hands the import over as `loadVrm`:
|
|
9
|
+
* `loadVrm: () => import('@pixiv/three-vrm')`. That one line is what lets ITS
|
|
10
|
+
* bundler see the package.
|
|
11
|
+
*
|
|
12
|
+
* API used (three-vrm v3, https://pixiv.github.io/three-vrm/packages/three-vrm/docs/):
|
|
13
|
+
* `VRMLoaderPlugin` registered on a `GLTFLoader` leaves the `VRM` on
|
|
14
|
+
* `gltf.userData.vrm`; `vrm.expressionManager.setValue(name, 0..1)`;
|
|
15
|
+
* `vrm.lookAt.target`; `vrm.humanoid.getNormalizedBoneNode(bone)`;
|
|
16
|
+
* `vrm.update(deltaSeconds)`; `VRMUtils.rotateVRM0(vrm)`.
|
|
17
|
+
*/
|
|
18
|
+
import { Vector3, type Camera, type Object3D } from 'three';
|
|
19
|
+
import type { AgentExpression } from '@chatlychat/core';
|
|
20
|
+
export declare const VRM_PEER = "@pixiv/three-vrm";
|
|
21
|
+
/** The slice of three-vrm's `VRM` the SDK touches, so a spec can stand in. */
|
|
22
|
+
export interface VrmLike {
|
|
23
|
+
readonly scene: Object3D;
|
|
24
|
+
readonly expressionManager?: {
|
|
25
|
+
setValue(name: string, weight: number): void;
|
|
26
|
+
} | null;
|
|
27
|
+
readonly lookAt?: {
|
|
28
|
+
target?: Object3D | null;
|
|
29
|
+
} | null;
|
|
30
|
+
readonly humanoid?: {
|
|
31
|
+
getNormalizedBoneNode(name: string): Object3D | null;
|
|
32
|
+
} | null;
|
|
33
|
+
update(deltaSeconds: number): void;
|
|
34
|
+
}
|
|
35
|
+
/** The slice of the `@pixiv/three-vrm` module the loader needs. */
|
|
36
|
+
export interface VrmModule {
|
|
37
|
+
readonly VRMLoaderPlugin: new (parser: unknown) => unknown;
|
|
38
|
+
readonly VRMUtils?: {
|
|
39
|
+
rotateVRM0?(vrm: VrmLike): void;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** What a host passes as `loadVrm`: `() => import('@pixiv/three-vrm')`. */
|
|
43
|
+
export type VrmModuleLoader = () => Promise<VrmModule>;
|
|
44
|
+
/** The module, or a typed error that names the missing peer and how to fix it. */
|
|
45
|
+
export declare function loadVrmModule(custom?: VrmModuleLoader): Promise<VrmModule>;
|
|
46
|
+
/** The glTF carries a VRM 0.x (`VRM`) or 1.0 (`VRMC_vrm`) extension. */
|
|
47
|
+
export declare function hasVrmExtension(gltf: {
|
|
48
|
+
userData?: Record<string, unknown>;
|
|
49
|
+
parser?: {
|
|
50
|
+
json?: {
|
|
51
|
+
extensionsUsed?: unknown;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}): boolean;
|
|
55
|
+
/** Which loader an avatar needs: its declared format wins; the extension catches an unlabelled file. */
|
|
56
|
+
export declare const wantsVrm: (format: string | undefined, gltf?: Parameters<typeof hasVrmExtension>[0]) => boolean;
|
|
57
|
+
export type VrmVowel = 'aa' | 'ih' | 'ou' | 'ee' | 'oh';
|
|
58
|
+
/**
|
|
59
|
+
* Chatly viseme -> one of VRM's five mouth expressions, and how far to open it.
|
|
60
|
+
* Keys are compared lower-case with any `viseme_` prefix removed. A viseme not
|
|
61
|
+
* listed, `sil` and `PP` (lips shut) all close the mouth.
|
|
62
|
+
*/
|
|
63
|
+
export declare const VISEME_TO_VRM: Readonly<Record<string, readonly [VrmVowel, number] | null>>;
|
|
64
|
+
export declare const VRM_VOWELS: readonly VrmVowel[];
|
|
65
|
+
export declare function vrmVisemeFor(v: string): readonly [VrmVowel, number] | null;
|
|
66
|
+
/**
|
|
67
|
+
* Chatly `embodiment.expression` -> VRM preset and weight. The rest (`nod`,
|
|
68
|
+
* `shake_head`, `point`, `wave`, `shrug`, `think`) are gestures, not faces: they
|
|
69
|
+
* play only as the host's clip from `presence.expressions`. No Chatly expression
|
|
70
|
+
* is `angry` or `relaxed`, so those presets are never driven.
|
|
71
|
+
*/
|
|
72
|
+
export declare const EXPRESSION_TO_VRM: Readonly<Partial<Record<AgentExpression, readonly [string, number]>>>;
|
|
73
|
+
/** Drives one loaded VRM: mouth, face, blink, gaze, and `vrm.update`. */
|
|
74
|
+
export declare class VrmRig {
|
|
75
|
+
readonly vrm: VrmLike;
|
|
76
|
+
reduced: boolean;
|
|
77
|
+
private readonly target;
|
|
78
|
+
private face;
|
|
79
|
+
private mouth;
|
|
80
|
+
private clock;
|
|
81
|
+
private head;
|
|
82
|
+
constructor(vrm: VrmLike, reduced: boolean);
|
|
83
|
+
get gazeTarget(): Object3D;
|
|
84
|
+
private set;
|
|
85
|
+
/** Open one of the five vowels (or close the mouth with null). Always zeroes the other four. */
|
|
86
|
+
setMouth(v: string | null, w: number): void;
|
|
87
|
+
/** Show a face for a cue; false when the expression is a gesture with no VRM preset. */
|
|
88
|
+
express(e: AgentExpression | null): boolean;
|
|
89
|
+
/** Point the eyes and head at a world position (null = release the head). */
|
|
90
|
+
gazeAt(root: Object3D, at: Vector3 | null, dt: number): void;
|
|
91
|
+
/** Advance the face and blink, then `vrm.update`. Call after the mixer and the gaze. */
|
|
92
|
+
update(dt: number): void;
|
|
93
|
+
get openVowel(): VrmVowel | null;
|
|
94
|
+
}
|
|
95
|
+
/** Where the agent should look, as a world position, for `gazeAt`. */
|
|
96
|
+
export declare function gazePoint(gaze: Object3D | Vector3 | 'visitor' | null, camera: Camera): Vector3 | null;
|
|
97
|
+
//# sourceMappingURL=vrm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vrm.d.ts","sourceRoot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QAAQ,CAEhC;IAED,OAAO,CAAC,GAAG;IAIX,gGAAgG;IACzF,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IASlD,wFAAwF;IACjF,OAAO,CAAC,CAAC,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO;IAYlD,6EAA6E;IACtE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IA+BnE,wFAAwF;IACjF,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IA4B/B,IAAW,SAAS,IAAI,QAAQ,GAAG,IAAI,CAEtC;CACF;AAED,sEAAsE;AACtE,wBAAgB,SAAS,CACvB,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,EAC3C,MAAM,EAAE,MAAM,GACb,OAAO,GAAG,IAAI,CAQhB"}
|
package/dist/vrm.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VRM avatars — the optional half of the agent's body.
|
|
3
|
+
*
|
|
4
|
+
* `@pixiv/three-vrm` is an OPTIONAL peer dependency. This file never imports
|
|
5
|
+
* it statically, and the dynamic import below names it through a computed
|
|
6
|
+
* specifier, so no bundler resolves it while building a glTF-only host: that
|
|
7
|
+
* host neither installs it nor ships a byte of it. A host that does use VRM
|
|
8
|
+
* installs it and, if it bundles, hands the import over as `loadVrm`:
|
|
9
|
+
* `loadVrm: () => import('@pixiv/three-vrm')`. That one line is what lets ITS
|
|
10
|
+
* bundler see the package.
|
|
11
|
+
*
|
|
12
|
+
* API used (three-vrm v3, https://pixiv.github.io/three-vrm/packages/three-vrm/docs/):
|
|
13
|
+
* `VRMLoaderPlugin` registered on a `GLTFLoader` leaves the `VRM` on
|
|
14
|
+
* `gltf.userData.vrm`; `vrm.expressionManager.setValue(name, 0..1)`;
|
|
15
|
+
* `vrm.lookAt.target`; `vrm.humanoid.getNormalizedBoneNode(bone)`;
|
|
16
|
+
* `vrm.update(deltaSeconds)`; `VRMUtils.rotateVRM0(vrm)`.
|
|
17
|
+
*/
|
|
18
|
+
import { Group, Vector3 } from 'three';
|
|
19
|
+
import { WorldError } from './types.js';
|
|
20
|
+
export const VRM_PEER = '@pixiv/three-vrm';
|
|
21
|
+
/** The module, or a typed error that names the missing peer and how to fix it. */
|
|
22
|
+
export async function loadVrmModule(custom) {
|
|
23
|
+
try {
|
|
24
|
+
// A computed specifier on purpose: see the header.
|
|
25
|
+
const spec = ['@pixiv', 'three-vrm'].join('/');
|
|
26
|
+
const mod = await (custom ??
|
|
27
|
+
(() => import(/* @vite-ignore */ /* webpackIgnore: true */ spec)))();
|
|
28
|
+
if (typeof mod.VRMLoaderPlugin !== 'function') {
|
|
29
|
+
throw new Error('no VRMLoaderPlugin export');
|
|
30
|
+
}
|
|
31
|
+
return mod;
|
|
32
|
+
}
|
|
33
|
+
catch (cause) {
|
|
34
|
+
const e = new WorldError('missing_peer', `VRM avatars need the optional peer dependency ${VRM_PEER}. Run \`npm install ${VRM_PEER}\`; ` +
|
|
35
|
+
`if you bundle, also pass \`loadVrm\` (a function returning import(...) of it) to createWorld.`);
|
|
36
|
+
e.cause = cause;
|
|
37
|
+
throw e;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** The glTF carries a VRM 0.x (`VRM`) or 1.0 (`VRMC_vrm`) extension. */
|
|
41
|
+
export function hasVrmExtension(gltf) {
|
|
42
|
+
const ext = gltf.userData?.['gltfExtensions'];
|
|
43
|
+
if (typeof ext === 'object' && ext !== null && ('VRM' in ext || 'VRMC_vrm' in ext)) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
const used = gltf.parser?.json?.extensionsUsed;
|
|
47
|
+
return Array.isArray(used) && used.some((x) => x === 'VRM' || x === 'VRMC_vrm');
|
|
48
|
+
}
|
|
49
|
+
/** Which loader an avatar needs: its declared format wins; the extension catches an unlabelled file. */
|
|
50
|
+
export const wantsVrm = (format, gltf) => format === 'vrm' || (gltf !== undefined && hasVrmExtension(gltf));
|
|
51
|
+
/**
|
|
52
|
+
* Chatly viseme -> one of VRM's five mouth expressions, and how far to open it.
|
|
53
|
+
* Keys are compared lower-case with any `viseme_` prefix removed. A viseme not
|
|
54
|
+
* listed, `sil` and `PP` (lips shut) all close the mouth.
|
|
55
|
+
*/
|
|
56
|
+
export const VISEME_TO_VRM = {
|
|
57
|
+
// VRM's own vowels, and the Oculus vowels.
|
|
58
|
+
aa: ['aa', 1],
|
|
59
|
+
ih: ['ih', 1],
|
|
60
|
+
ou: ['ou', 1],
|
|
61
|
+
ee: ['ee', 1],
|
|
62
|
+
oh: ['oh', 1],
|
|
63
|
+
e: ['ee', 1],
|
|
64
|
+
i: ['ih', 1],
|
|
65
|
+
o: ['oh', 1],
|
|
66
|
+
u: ['ou', 1],
|
|
67
|
+
// Oculus consonants: the nearest vowel shape, held shallower.
|
|
68
|
+
ff: ['ih', 0.4],
|
|
69
|
+
th: ['ih', 0.5],
|
|
70
|
+
dd: ['aa', 0.4],
|
|
71
|
+
kk: ['aa', 0.4],
|
|
72
|
+
ch: ['ou', 0.5],
|
|
73
|
+
ss: ['ih', 0.5],
|
|
74
|
+
nn: ['ih', 0.3],
|
|
75
|
+
rr: ['ou', 0.5],
|
|
76
|
+
pp: null,
|
|
77
|
+
sil: null,
|
|
78
|
+
};
|
|
79
|
+
export const VRM_VOWELS = ['aa', 'ih', 'ou', 'ee', 'oh'];
|
|
80
|
+
export function vrmVisemeFor(v) {
|
|
81
|
+
return VISEME_TO_VRM[v.toLowerCase().replace(/^viseme_/, '')] ?? null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Chatly `embodiment.expression` -> VRM preset and weight. The rest (`nod`,
|
|
85
|
+
* `shake_head`, `point`, `wave`, `shrug`, `think`) are gestures, not faces: they
|
|
86
|
+
* play only as the host's clip from `presence.expressions`. No Chatly expression
|
|
87
|
+
* is `angry` or `relaxed`, so those presets are never driven.
|
|
88
|
+
*/
|
|
89
|
+
export const EXPRESSION_TO_VRM = {
|
|
90
|
+
smile: ['happy', 0.7],
|
|
91
|
+
laugh: ['happy', 1],
|
|
92
|
+
surprised: ['surprised', 1],
|
|
93
|
+
concerned: ['sad', 0.6],
|
|
94
|
+
};
|
|
95
|
+
const HOLD_S = 2.5;
|
|
96
|
+
const FADE_OUT_S = 0.5;
|
|
97
|
+
const EASE_IN_S = 0.12;
|
|
98
|
+
const BLINK_EVERY_S = 4;
|
|
99
|
+
const BLINK_S = 0.15;
|
|
100
|
+
const HEAD_YAW = 0.6;
|
|
101
|
+
const HEAD_PITCH = 0.35;
|
|
102
|
+
const HEAD_RATE = 8;
|
|
103
|
+
/** Drives one loaded VRM: mouth, face, blink, gaze, and `vrm.update`. */
|
|
104
|
+
export class VrmRig {
|
|
105
|
+
vrm;
|
|
106
|
+
reduced;
|
|
107
|
+
target = new Group();
|
|
108
|
+
face = null;
|
|
109
|
+
mouth = null;
|
|
110
|
+
clock = 0;
|
|
111
|
+
head = { yaw: 0, pitch: 0 };
|
|
112
|
+
constructor(vrm, reduced) {
|
|
113
|
+
this.vrm = vrm;
|
|
114
|
+
this.reduced = reduced;
|
|
115
|
+
this.target.name = 'cl3-agent-gaze';
|
|
116
|
+
if (vrm.lookAt != null) {
|
|
117
|
+
vrm.lookAt.target = this.target;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
get gazeTarget() {
|
|
121
|
+
return this.target;
|
|
122
|
+
}
|
|
123
|
+
set(name, w) {
|
|
124
|
+
this.vrm.expressionManager?.setValue(name, w);
|
|
125
|
+
}
|
|
126
|
+
/** Open one of the five vowels (or close the mouth with null). Always zeroes the other four. */
|
|
127
|
+
setMouth(v, w) {
|
|
128
|
+
const hit = v === null ? null : vrmVisemeFor(v);
|
|
129
|
+
const vowel = hit === null ? null : hit[0];
|
|
130
|
+
for (const name of VRM_VOWELS) {
|
|
131
|
+
this.set(name, name === vowel ? Math.min(1, w * (hit?.[1] ?? 0)) : 0);
|
|
132
|
+
}
|
|
133
|
+
this.mouth = vowel;
|
|
134
|
+
}
|
|
135
|
+
/** Show a face for a cue; false when the expression is a gesture with no VRM preset. */
|
|
136
|
+
express(e) {
|
|
137
|
+
const p = e === null ? undefined : EXPRESSION_TO_VRM[e];
|
|
138
|
+
if (p === undefined) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
if (this.face !== null && this.face.name !== p[0]) {
|
|
142
|
+
this.set(this.face.name, 0);
|
|
143
|
+
}
|
|
144
|
+
this.face = { name: p[0], weight: p[1], age: 0 };
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
/** Point the eyes and head at a world position (null = release the head). */
|
|
148
|
+
gazeAt(root, at, dt) {
|
|
149
|
+
const bone = this.vrm.humanoid?.getNormalizedBoneNode('head');
|
|
150
|
+
const k = this.reduced ? 1 : 1 - Math.exp(-HEAD_RATE * dt);
|
|
151
|
+
let yaw = 0;
|
|
152
|
+
let pitch = 0;
|
|
153
|
+
if (at !== null && bone != null) {
|
|
154
|
+
this.target.position.copy(at);
|
|
155
|
+
this.target.updateMatrixWorld(true);
|
|
156
|
+
const from = root.worldToLocal(bone.getWorldPosition(new Vector3()));
|
|
157
|
+
const to = root.worldToLocal(at.clone());
|
|
158
|
+
const dx = to.x - from.x;
|
|
159
|
+
const dz = to.z - from.z;
|
|
160
|
+
yaw = Math.max(-HEAD_YAW, Math.min(HEAD_YAW, Math.atan2(dx, dz)));
|
|
161
|
+
pitch = Math.max(-HEAD_PITCH, Math.min(HEAD_PITCH, -Math.atan2(to.y - from.y, Math.hypot(dx, dz))));
|
|
162
|
+
}
|
|
163
|
+
this.head = {
|
|
164
|
+
yaw: this.head.yaw + (yaw - this.head.yaw) * k,
|
|
165
|
+
pitch: this.head.pitch + (pitch - this.head.pitch) * k,
|
|
166
|
+
};
|
|
167
|
+
// A head never driven is left to the clips; one released is eased home, then left alone.
|
|
168
|
+
if (bone != null &&
|
|
169
|
+
(at !== null || Math.abs(this.head.yaw) + Math.abs(this.head.pitch) > 1e-3)) {
|
|
170
|
+
bone.rotation.set(this.head.pitch, this.head.yaw, 0);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/** Advance the face and blink, then `vrm.update`. Call after the mixer and the gaze. */
|
|
174
|
+
update(dt) {
|
|
175
|
+
this.clock += dt;
|
|
176
|
+
const f = this.face;
|
|
177
|
+
if (f !== null) {
|
|
178
|
+
f.age += dt;
|
|
179
|
+
const fade = this.reduced ? 0 : FADE_OUT_S;
|
|
180
|
+
const k = this.reduced
|
|
181
|
+
? Number(f.age <= HOLD_S)
|
|
182
|
+
: f.age < EASE_IN_S
|
|
183
|
+
? f.age / EASE_IN_S
|
|
184
|
+
: f.age <= HOLD_S
|
|
185
|
+
? 1
|
|
186
|
+
: 1 - (f.age - HOLD_S) / fade;
|
|
187
|
+
this.set(f.name, f.weight * Math.max(0, Math.min(1, k)));
|
|
188
|
+
if (f.age >= HOLD_S + fade) {
|
|
189
|
+
this.set(f.name, 0);
|
|
190
|
+
this.face = null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// A held, motionless blink would read as a fault, so reduced motion has none.
|
|
194
|
+
const phase = this.clock % BLINK_EVERY_S;
|
|
195
|
+
this.set('blink', this.reduced || phase > BLINK_S ? 0 : 1 - Math.abs(1 - (2 * phase) / BLINK_S));
|
|
196
|
+
this.vrm.update(dt);
|
|
197
|
+
}
|
|
198
|
+
get openVowel() {
|
|
199
|
+
return this.mouth;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** Where the agent should look, as a world position, for `gazeAt`. */
|
|
203
|
+
export function gazePoint(gaze, camera) {
|
|
204
|
+
if (gaze === null) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
if (gaze === 'visitor') {
|
|
208
|
+
return camera.getWorldPosition(new Vector3());
|
|
209
|
+
}
|
|
210
|
+
return gaze instanceof Vector3 ? gaze : gaze.getWorldPosition(new Vector3());
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=vrm.js.map
|
package/dist/vrm.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vrm.js","sourceRoot":"","sources":["../src/vrm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAA8B,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxC,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAoB3C,kFAAkF;AAClF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAwB;IAC1D,IAAI,CAAC;QACH,mDAAmD;QACnD,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,MAAM,CAChB,MAAM;YACN,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,IAAI,CAAuB,CAAC,CACxF,EAAE,CAAC;QACJ,IAAI,OAAO,GAAG,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,GAAG,IAAI,UAAU,CACtB,cAAc,EACd,iDAAiD,QAAQ,uBAAuB,QAAQ,MAAM;YAC5F,+FAA+F,CAClG,CAAC;QACD,CAAyB,CAAC,KAAK,GAAG,KAAK,CAAC;QACzC,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAAC,IAG/B;IACC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,E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,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACnB,CAAC;QACH,CAAC;QACD,8EAA8E;QAC9E,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC;QACzC,IAAI,CAAC,GAAG,CACN,OAAO,EACP,IAAI,CAAC,OAAO,IAAI,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,CAC9E,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAED,sEAAsE;AACtE,MAAM,UAAU,SAAS,CACvB,IAA2C,EAC3C,MAAc;IAEd,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,gBAAgB,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,IAAI,YAAY,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AAC/E,CAAC"}
|
package/dist/world.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../src/world.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../src/world.ts"],"names":[],"mappings":"AAmDA,OAAO,EAA8C,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAG3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW,CA2a3D"}
|