Commit Graph
39 Commits
Author SHA1 Message Date
leafyy aa69ee62b5 refactor(lipsync): share renderer vowel policy (#2374)
## Description

The VRM and MMD renderers had the same two boundary problems:

- Both imported the Stage audio store from the `stage-ui` source tree.
- Both kept copies of the wLipSync profile and model-neutral vowel
policy.

This PR solves both problems as one architecture change.

```text
Stage owns AudioContext and the current audio source
  -> ThreeScene / MMDScene receive both as inputs
    -> model-driver-lipsync owns the profile and shared vowel policy
      -> VRM maps AEIOU to aa / ee / ih / oh / ou
      -> MMD maps AEIOU to vowelA / vowelE / vowelI / vowelO / vowelU
```

The shared driver owns viseme projection, winner and runner selection,
silence handling, and smoothing. It has no Vue, Three.js, VRM, or MMD
dependency. Each renderer keeps only its model-specific mapping.

The renderer packages no longer import the Stage audio store or depend
directly on `wlipsync`. Stage passes the owning `AudioContext` down with
the current audio source. Cleanup disconnects only the wLipSync node
owned by that renderer.

## Current solution

The package-boundary review identified two related findings:

- Finding 3: The VRM and MMD renderers imported `stage-ui` audio state
through source paths.
- Finding 4: The same renderers duplicated the wLipSync profile and
model-neutral vowel policy.

Both findings came from one missing boundary between Stage, the lip-sync
driver, and the renderer adapters. This PR fixes that boundary with one
ownership change.

| Layer | Responsibility |
| --- | --- |
| `stage-ui` | Owns the `AudioContext` and the current audio source. It
passes both values to each renderer. |
| `stage-ui-three` and `stage-ui-mmd` | Connect renderer components to
the shared driver. They do not import the Stage audio store. |
| `model-driver-lipsync/runtime/wlipsync` | Exposes `createWLipSyncNode`
as the public runtime entry. |
| `model-driver-lipsync/shared/wlipsync` | Owns the profile, public
types, and model-neutral vowel policy. |

Runtime flow:

1. `Stage.vue` passes `audioContext` and `currentAudioSource` to
`ThreeScene` or `MMDScene`.
2. The renderer composable watches the context and creates one wLipSync
node for that context.
3. The source watcher connects the current audio source to that node.
4. Each render frame sends the wLipSync values to
`createWLipSyncVowelDriver`.
5. The renderer adapter applies the returned AEIOU weights to its model
controls.
6. Cleanup disconnects the exact source and node pair that the renderer
owns.

The shared policy keeps the current renderer behavior:

- It maps the raw `S` viseme to `I`.
- It selects the two strongest vowels.
- It uses the existing volume and silence thresholds.
- It keeps the 160 ms silence window.
- It keeps the existing attack, release, cap, and output scale values.

The renderer-specific mappings stay in their renderer packages:

- VRM maps AEIOU to `aa`, `ee`, `ih`, `oh`, and `ou`.
- MMD maps AEIOU to `vowelA`, `vowelE`, `vowelI`, `vowelO`, and
`vowelU`.

This solution removes both duplicate profile files. It also removes the
direct `wlipsync` dependencies from both renderer packages.

## Linked Issues

None.

## Additional Context

There is no intended visual change. This refactor preserves the existing
vowel weights and renderer mappings.

Verification:

- `sem diff --staged --no-cosmetics -v --file-exts .ts .tsx`
- `sem diff --staged --no-cosmetics -v --file-exts .vue`
- `sem impact --entity-id <useVRMLipSync> --json --dependents`
- `sem impact --entity-id <useMMDLipSync> --json --dependents`
- `pnpm -F @proj-airi/model-driver-lipsync test` — 3 tests passed
- `pnpm -F @proj-airi/stage-ui-three exec vitest run` — 18 tests passed
- `pnpm -F @proj-airi/stage-ui-mmd exec vitest run` — 23 tests passed
- Type checks passed for `model-driver-lipsync`, `stage-ui-three`,
`stage-ui-mmd`, and `stage-ui`
- `pnpm install --frozen-lockfile --ignore-scripts`
- `pnpm lint` — 0 errors and 7 existing warnings outside this change
- `git diff --check`

The full workspace `pnpm typecheck` was also run. In the isolated
worktree it stopped in unchanged `electron-vueuse` and
`plugin-sdk-tamagotchi` because their generated dependency outputs were
not present. All affected package type checks above passed.
2026-08-31 14:58:43 +08:00
RainbowBird 007fae6810 chore: update package dependencies and remove specific catalog references
- Removed specific catalog references for '@unocss/core', 'es-toolkit', 'nanoid', and 'valibot' in pnpm-workspace.yaml and various service package.json files.
- Updated versions for '@vueuse/core', 'es-toolkit', 'nanoid', 'reka-ui', and 'valibot' to their latest compatible versions.
- Cleaned up unused catalog entries in pnpm-workspace.yaml.
2026-06-07 19:45:28 +08:00
RainbowBird 7841df28f8 build(deps): migrate workspace dependencies to catalogs
Move direct external dependency versions into pnpm catalogs and update workspace packages to reference catalog entries.

Signed-off-by: RainbowBird <git@luoling.moe>

Commit-Message-Assisted-by: Codex
2026-06-03 17:12:13 +08:00
Makito 7c76ea680c chore(pnpm): fix pnpm-workspaces issues and update catalog for vitest 2026-05-20 11:38:20 +09:00
DrHuangMHT c2bf73c95d fix(stage-*): follow-up fix for #1696 (#1809) 2026-05-19 13:54:41 +08:00
Neko Ayaka 2ab21879dd chore(deps): bump dependencies 2026-04-18 19:18:17 +08:00
Neko Ayaka 95eac8e41c chore(deps): bump dependencies 2026-04-11 04:00:49 +08:00
RainbowBird b0576d3b89 chore(deps): move eventa to catalog 2026-03-26 21:45:01 +08:00
Neko Ayaka ac1de680d0 chore(deps): bump dependencies 2026-03-23 02:15:40 +08:00
dec2b04924 refactor: vrm performance tracing and better lifecycle management (#1194)
* refactor: vrm performance tracing and better lifecycle management

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Rename lag-visualizer.vue to performance-visualizer.vue

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @sumimakito

Co-authored-by: Makito <i@maki.to>

* Apply suggestion from @sumimakito

Co-authored-by: Makito <i@maki.to>

* Apply suggestion from @sumimakito

Co-authored-by: Makito <i@maki.to>

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* [autofix.ci] apply automated fixes

* Apply suggestion from @Lilia-Chen

* [autofix.ci] apply automated fixes

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* [autofix.ci] apply automated fixes

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* [autofix.ci] apply automated fixes

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* Apply suggestion from @Lilia-Chen

* fix: some tiny bugs and model URL lifecycle

* fix: TresCanvas size=0 bug

* Delete .claude/settings.json

* fix: some clean-up

* [autofix.ci] apply automated fixes

* fix: use screen to wrap up TresCanvas

* Delete .claude/settings.json

---------

Co-authored-by: Makito <i@maki.to>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Neko <neko@ayaka.moe>
2026-03-12 09:20:20 +08:00
Neko Ayaka 92d87833be chore(deps): bump dependencies 2026-02-26 18:33:52 +08:00
Neko Ayaka d051a07da9 chore(deps): bump dependencies 2026-01-21 05:42:01 +08:00
Neko Ayaka e38366d37b fix(deps): sync vue to catalog: 2026-01-17 15:57:54 +08:00
Neko Ayaka bd9d5be254 feat(stage-ui,stage-ui-three): support fade on hover for three 2026-01-08 15:02:52 +08:00
Neko Ayaka 20b6978a9d refactor(stage-ui,stage-ui-live2d,stage-ui-three): split out stage-ui-live2d component 2026-01-08 00:31:07 +08:00
RinandNeko Ayaka 4f0477a2a0 fix(stage-ui,stage-ui-three): resolve tamagotchi VRM loading screen hang on startup (#904)
---------

Co-authored-by: Neko Ayaka <neko@ayaka.moe>
2026-01-07 22:23:01 +08:00
Neko Ayaka 0ef110aae5 feat(stage-ui-three): support loading three as preview cover of model 2026-01-04 04:50:44 +08:00
Neko Ayaka a07854ca31 chore(deps): bump dependencies 2025-12-27 04:26:56 +08:00
Neko Ayaka 2ffe666368 chore(deps): bump dependencies 2025-12-21 18:41:11 +08:00
Neko Ayaka 7158c200bb chore(deps): bump dependencies 2025-12-21 18:35:34 +08:00
Neko Ayaka c9a9ec7bfa Revert "chore(deps): bump dependencies"
This reverts commit 349810ff27.
2025-12-21 17:16:47 +08:00
Neko Ayaka 349810ff27 chore(deps): bump dependencies 2025-12-21 15:58:52 +08:00
Neko Ayaka a3dba4f3cf chore(deps): bump dependencies & electron-builder 2025-12-13 16:23:45 +08:00
Neko Ayaka fafba1cdf8 chore(deps): bump dependencies 2025-12-11 02:22:43 +08:00
Neko Ayaka 37b47219c8 fix(stage-tamagotchi,stage-ui): withBase incorrectly used causes model url issues
Close #773
2025-11-28 14:26:10 +08:00
Neko Ayaka 075a733909 refactor: dep cleanup 2025-11-20 16:00:44 +08:00
Neko Ayaka 3e741d57ec chore(deps): bump dependencies 2025-11-16 02:21:38 +08:00
Neko Ayaka 5b9bf180e9 Revert "chore(deps): bump dependencies"
This reverts commit 38401084e1.
2025-11-16 01:28:29 +08:00
Neko Ayaka 38401084e1 chore(deps): bump dependencies 2025-11-15 23:45:01 +08:00
Neko Ayaka a7a1302b99 chore(deps): bump dependencies 2025-11-01 16:03:45 +08:00
Neko Ayaka 33de7d49bf feat(stage-shared): new stage-shared package 2025-10-12 03:30:20 +08:00
Neko Ayaka 0b85ab78fc chore(deps): bump dependencies 2025-10-12 00:36:21 +08:00
Neko Ayaka 0de306f668 chore(deps): bump dependencies 2025-10-09 02:35:44 +08:00
Neko Ayaka 6cfc9c8ee0 fix(stage-tamagotchi): icon 2025-10-06 14:57:49 +08:00
Neko Ayaka 75321a4cd9 chore(deps): bump dependencies 2025-10-03 16:54:50 +08:00
藍+85CDandNeko Ayaka de3f8d952c feat(stage-ui-three): vrm lip-sync (#620)
---------

Co-authored-by: Neko Ayaka <neko@ayaka.moe>
2025-10-01 00:52:56 +08:00
Neko AyakaandIro 7ea96b7c00 feat(tresjs): added tresjs package with new Tresjs v5 integrated post-processing components
Fix #605

- https://github.com/Tresjs/post-processing/issues/212

Co-authored-by: Iro <155815508+Iro96@users.noreply.github.com>
2025-09-28 14:12:13 +08:00
Neko Ayaka 372125fb89 chore(deps): bump dependencies
Notice: after bumping up to three 0.180.0 with @types/three 0.180.0,
  Argument of type 'Group<Object3DEventMap>' is not assignable to parameter of type 'Object3D<Object3DEventMap>'.
    Type 'Group<Object3DEventMap>' is missing the following properties from type 'Object3D<Object3DEventMap>': setPointerCapture, releasePointerCapture, hasPointerCapture

Currently, AFAIK, clearly, three, and @types/three doesn't have the setPointerCapture, releasePointerCapture, hasPointerCapture method / getters
The only place I found on GitHub, points out that https://github.com/pmndrs/xr/blob/456aa380206e93888cd3a5741a1534e672ae3106/packages/pointer-events/src/pointer.ts#L69-L100 declares

```js
declare module 'three' {
  interface Object3D {
    setPointerCapture(pointerId: number): void
    releasePointerCapture(pointerId: number): void
    hasPointerCapture(pointerId: number): boolean

    intersectChildren?: boolean
    interactableDescendants?: Array<Object3D>
    /**
     * @deprecated
     */
    ancestorsHaveListeners?: boolean
    ancestorsHavePointerListeners?: boolean
    ancestorsHaveWheelListeners?: boolean
  }
}
```

And in @tresjs/core v5, it uses the @pmndrs/pointer-events internally.
Somehow the Object3D from @types/three and the one augmented by @pmndrs/pointer-events are not compatible.

`new Object3D() as unknown as Object3D` works as workaround here but there should be no need to do such a thing since these two Object3D should be the same.
With no updates from `typescript`, I assume there is no breaking change or regression from `typescript` side.
2025-09-26 17:07:07 +08:00
Lilia_Chen 5459741276 refactor(stage-ui,renderer-three) - three-scene package (#569) 2025-09-25 21:59:29 +08:00