Skip to content

feat(core): add VRMC_vrm extension models#45

Open
nhiroyasu wants to merge 18 commits into
mainfrom
feat/vrm
Open

feat(core): add VRMC_vrm extension models#45
nhiroyasu wants to merge 18 commits into
mainfrom
feat/vrm

Conversation

@nhiroyasu

@nhiroyasu nhiroyasu commented May 2, 2026

Copy link
Copy Markdown
Owner

Changes

  • Add VRMC_vrm extension models and decoding tests
  • Merge remote-tracking branch 'origin/main' into feat/vrm
  • Add VRM humanoid support and interactive debug HUD
  • Represent VRM humanoid rotations as Euler degrees (SIMD3)
  • Add scroll-adjusting fields, collapsible VRM humanoid panel, and scrollable debug HUD
  • Group humanoid debug HUD into collapsible sections and iterate all bones

Preview

スクリーンショット 2026-05-02 19 47 41

nhiroyasu added 7 commits May 2, 2026 12:57
Add full Codable model support for the VRMC_vrm glTF extension and wire it into GLTFExtensions as "VRMC_vrm". Implement types and enums for VRMCVrm, VRMCVrmMeta, humanoid/bones, firstPerson, lookAt, expressions, morph/material/texture binds, and texture transform defaults. Provide custom decoding fallbacks for meta and expression/default values. Add comprehensive unit tests (VRMCVrmDecodingTests) to verify minimal, optional, and default decoding behavior.
- Add VRM 0.x extension types and decoding to SwiftGLTFCore (VRM0Vrm, VRM0Humanoid, VRM0HumanBone, VRMHumanoidBoneName, node mapping helpers).
- Extend GLTF parser to expose VRM humanoid data via MDLObject (GLTFVRM) and new GLTFAssetPath entries.
- Propagate humanoid node map into mesh pipeline (PBRMeshBundle, PBRMeshLoader) and map to NodeHierarchyOffset.
- Introduce runtime VRM humanoid rotation support: expose vrmHumanoidRotations across GLTFSwiftUIView / GLTFView / RenderingContext and apply rotations in renderer (encodeNodeTransforms) before animation updates.
- Add VRMHumanoidDebugHUDView (iOS/macOS) to inspect/edit bone rotations and hook up UI to update rotations; integrate into GLTFView HUD.
- Add unit tests for VRM0 decoding.
- Minor UI tweak: replace reset button bezelStyle with bezelColor for consistent appearance.
…D3<Float>)

- Change VRM humanoid rotation types from simd_quatf to SIMD3<Float> across SwiftGLTF views, GLTFView, VRMHumanoidDebugHUDView, RenderingContext, and PBRRenderer.
- Remove quaternion/euler utilities from the debug HUD and add quaternion(fromEulerDegrees:) helper in renderer helper.
- Convert Euler-degree vectors to quaternions when applying rotations in PBRRenderer.
- Update debug HUD callbacks and reset logic to emit/use SIMD3<Float> (.zero) instead of simd_quatf.
…l, and scrollable debug HUD

- Add DebugHUDScrollAdjustingTextField (macOS) to support mouse-wheel value adjustments with configurable scrollStep and fractionDigits; use it in CameraDebugHUDView and VRMHumanoidDebugHUDView.
- Wrap debug HUD in scroll views on iOS (UIScrollView) and macOS (NSScrollView) and update layout constraints to use content/frame layout guides.
- Add collapsible VRM Humanoid section with a header toggle and separate body stack on both iOS and macOS.
- Update field creation and widths to match new HUD layout.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0cf732963

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/SwiftGLTFRenderer/Renderer/PBRRenderer.swift Outdated
Comment thread Sources/SwiftGLTFCore/Types.swift Outdated
nhiroyasu added 5 commits May 2, 2026 20:30
Map left/right thumb proximal/intermediate/distal to corresponding VRM names (leftThumbProximal → leftThumbMetacarpal, leftThumbIntermediate → leftThumbProximal, leftThumbDistal → leftThumbDistal; same for right). Update unit tests to assert the new mappings and verify humanoid node map.
…ion transforms so animations can override them
- Add VRMExpressionKey and VRM0/VRM1 normalization helpers to core types
- Parse and normalize VRM expressions into GLTFVRMExpressions and attach to MDLAsset
- Bind expression morph targets to target nodes during node tree construction
- Expose expression weights through view APIs and add VRMExpressionDebugHUDView for iOS/macOS
- Introduce VRMExpression model and evaluator (resolveVRMExpressionMorphWeights) and integrate into renderer animation pass
- Propagate expression weights through RenderingContext and PBRRenderer
- Add mesh loader wiring to collect expression definitions and default morph weights
- Add tests for expression normalization and weight/resolution behavior
…p buffer; update shader/types and add VRM tests/assets
@nhiroyasu nhiroyasu changed the title feat(core): add VRMC_vrm extension models and decoding tests feat(core): add VRMC_vrm extension models Jun 13, 2026
…rarchy validation and metadata

Introduce NodeIndex-based node management and GLTFNodeMetadata/GLTFSceneRootNodes components.
Create a central "/Nodes" asset path and helper accessors on MDLAsset (gltfNodes, node(at:), sceneRootNodes).
Add validateNodeHierarchy(...) to detect invalid indices, duplicate parents, duplicate root nodes and cycles; call it during asset creation.
Replace MDLObject-bound references (jointObjects, targetNodes, animation/vrm binds) with index-based references and update GLTFSkin.jointPaths generation.
Store original node names and children as metadata components and set scene root node indices on scene objects.
Refactor builders and loaders (buildNodeObject, PBRMeshLoader, WireframeMeshLoader, NodeLevelHierarchy, PBRRenderer, VRM expression resolver) to traverse and resolve nodes by NodeIndex and use metadata instead of walking MDLObject children.
Adjust skin, animation, morph and camera handling to use NodeIndex values and update related buffers and mappings.
Add NodeHierarchyValidationTests and update existing tests to reflect the new node container layout and metadata behavior.
…rarchy usage

Remove obsolete per-mesh modelMatrix storage and related model/inverseModel buffers.
Simplify PBRMeshLoader APIs by removing parentTransform and nodeLevelHierarchy parameters
and update callers accordingly. Remove model/inverseModel fields from PBRVertexArguments
and drop heap allocations/buffer size reservations for model matrices. Rebuild shader
headers and metallib binaries to reflect the updated vertex argument layout.

BREAKING CHANGE: multiple PBRMeshLoader function signatures changed (removed nodeLevelHierarchy
and parentTransform) and PBRVertexArguments layout changed (model/inverseModel removed).
…r and PBRMeshLoader

Remove Japanese TODO about map ordering in Sources/SwiftGLTFParser/parser.swift and
remove TODOs about recursion and morph length handling in
Sources/SwiftGLTFRenderer/Model/PBRMeshLoader.swift. These are non-functional
cleanups with no change to runtime behavior.
…n; simplify node transform update flow and safely upload morph weights
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.

1 participant