Skip to content

refactor - MMD Model Loading#19

Merged
kwaa merged 11 commits into
mainfrom
lilia/refactor
Nov 30, 2025
Merged

refactor - MMD Model Loading#19
kwaa merged 11 commits into
mainfrom
lilia/refactor

Conversation

@Lilia-Chen

Copy link
Copy Markdown
Collaborator

PR Summary

  • Introduced a pluggable assembly pipeline via loader-deps.ts: parse → post-process → geometry → materials → bones → IK → grants → mesh → physics are all overridable through a Plugin that returns Partial<ThreeMMDLoaderDeps>.
  • Added physics abstraction: PhysicsStrategy + default factory buildPhysics; spring-bone implementation is now a functional factory createSpringBonePhysics (closure-backed state, swap-friendly).
  • Clarified Loader/MMD responsibilities: Loader assembles (parse/post-process/build…/physics); MMD holds the assembled mesh/constraints/physics strategy and exposes lifecycle hooks.
  • Centralised Z-flip in post-parse to normalise PMX to Three’s handedness; downstream builders should drop duplicate flips.

Design Highlights

  • Functional core + OOP shell: pure build funcs produce data, Loader/OOP handles assembly and lifecycle.
  • Pluginable deps: register(plugin) overrides specific steps by key; materials/physics/parse strategies can be hot-swapped.
  • Physics as a strategy: defaults to spring-bone, but buildPhysics/PhysicsStrategy<THelpers> allows other engines or disabling physics.

https://www.tldraw.com/f/-mkWrojbWfUXMsREqHs33?d=v248.-588.2300.1271.h6bzJK397xylpxp3u8dVm
shapes at 25-11-29 22 49 34

Next Step

  • Refactor buildMaterials to support more flexible and varied materials and shading.
  • Refactor build-animation related code

Comment thread examples/playground/src/hooks/use-mmd-loader.ts Outdated
Comment thread packages/three-mmd-b/src/loaders/three-mmd-b-loader.ts Outdated
Comment thread packages/three-mmd-b/src/loaders/three-mmd-b-loader.ts Outdated
@kwaa kwaa merged commit 6947f01 into main Nov 30, 2025
1 check passed
@kwaa kwaa deleted the lilia/refactor branch November 30, 2025 11:55
@Lilia-Chen Lilia-Chen self-assigned this Nov 30, 2025
@Lilia-Chen Lilia-Chen mentioned this pull request Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants