arkavo-org / arkavo-org/VRMMetalKit

GLTFCore: move computeWorldMatrices() from GLTFMetalKit so VRMMetalKit can also use the primitive

Open Beginner friendly
#243 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
6
Forks
2
Avg merge
18h 51m
Merged PRs (30d)
26

Description

## Context

`Sources/GLTFMetalKit/Loader/GLTFAssetLoader.swift` defines an internal `computeWorldMatrices(document:into:)` that walks the glTF node hierarchy from scene roots and accumulates per-node world matrices via parent × local TRS composition. The math is glTF-spec-generic — it doesn't touch any VRM-specific or PBR-specific concept.

VRMMetalKit currently doesn't call into it because its runtime takes a different path: humanoid retargeting changes which "joint hierarchy walk" is canonical (the VRMA retargeting layer maps source-skeleton joints to VRM bones before the walk; spring-bone simulation modifies joint transforms post-walk).

Surfaced as a follow-up in the PR #241 audit. Verdict: **partial sharing — moving the primitive is ~50 LOC, payoff is "available for future glTF-style consumers in VRMMetalKit" rather than collapsing existing duplication.**

## What's needed

- Move `computeWorldMatrices(document:into:)` from `Sources/GLTFMetalKit/Loader/GLTFAssetLoader.swift` to a new `Sources/GLTFCore/Animation/SceneGraph.swift` (or similar).
- Mark it `public`.
- Update GLTFMetalKit's call site to consume from GLTFCore.
- No VRMMetalKit-side change unless/until a consumer wants it.

## Acceptance

- swift build clean.
- All 1466 tests pass.
- Function is callable from VRMMetalKit if a future caller ever wants the glTF-style flat scene-walk (alongside or instead of the humanoid-retargeted path).

## Estimate

~30 minutes. Low risk.

## Note

This is the smallest of the documented follow-ups. Worth doing if you're already touching the area for another reason; not worth a standalone PR by itself.

Contributor guide

Open the contributing guide

Research direction

Start with computeWorldMatrices(document:into:) in Sources/GLTFMetalKit/Loader/GLTFAssetLoader.swift and the new Sources/GLTFCore/Animation/SceneGraph.swift location. Move the function as a public GLTFCore API, update the GLTFMetalKit call site, then run swift build and the test suite. Done means the build is clean, all 1466 tests pass, and VRMMetalKit can call the function.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
computer-graphics
Issue type
Refactor
Difficulty
2/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.