Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VRM 1.0 parsing support #29

Merged
merged 28 commits into from Apr 18, 2024
Merged

VRM 1.0 parsing support #29

merged 28 commits into from Apr 18, 2024

Conversation

is0263rf
Copy link
Contributor

@is0263rf is0263rf commented Apr 5, 2024

VRM 1.0のファイルを読み込む機能を追加しました。テストもつけています。

大きな変更点としては

  • VRM 1.0の構造体(VRM1.swift)を追加しました。
  • VRMLoaderにgenericsのload()を追加しました。(利用方法は後述)
  • VRM 1.0のVRMC_vrm, VRMC_node_constraint, VRMC_springBone, VRMC_materials_mtoonの読み込みを追加しています。

今回のPull Requestでは対応していない部分は以下の通りです。

  • VRM Animation(VRMC_vrm_animation, .vrmaファイル)の読み込み
  • VRM 1.0ファイルをSceneKitでレンダリングする機能

また、テストにあたってVRM 1.0のモデルをテストのAssetに入れています。モデルは下記URLからダウンロードしました。
https://github.com/vrm-c/vrm-specification/tree/master/samples/Seed-san

再配布可能で商用利用も可能だと書かれていたので問題ないとは思いますが、念の為ご確認ください。

次に新しいload()について説明します。
従来の実装は下記の通りです。

let vrm = try VRMLoader().load(withURL: url)

新しいload()を使うと下記の通りになります。

// load VRM 0.x file.
let vrm: VRM = try VRMLoader().load<VRM>(withURL: url)

// load VRM 1.0 file.
let vrm: VRM1 = try VRMLoader().load<VRM1>(withURL: url)

VRM2.0, VRM 3.0などが出た際も構造体を定義してload<VRM2>(withURL: url)と使うことができます。互換性のためにgenericsを使わないload()も残しています。VRMファイルのバージョンによらず、常にVRM 0.xとしてパースします。

let vrm = try VRMLoader().load(withURL: url)

@is0263rf is0263rf marked this pull request as draft April 5, 2024 07:22
@is0263rf is0263rf changed the title VRM 1.0 parsing support [WIP]VRM 1.0 parsing support Apr 5, 2024
@is0263rf
Copy link
Contributor Author

Related #27

@is0263rf is0263rf marked this pull request as ready for review April 12, 2024 07:01
@is0263rf is0263rf changed the title [WIP]VRM 1.0 parsing support VRM 1.0 parsing support Apr 12, 2024
Copy link
Owner

@tattn tattn left a comment

Choose a reason for hiding this comment

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

PR本当にありがとうございます!
ぜひマージしたいため、いくつかレビューコメントをさせていただきました。


Comments will be in Japanese only as this is a review between Japanese speakers.

Sources/VRMKit/Extensions/GlobalFunction.swift Outdated Show resolved Hide resolved
Sources/VRMKit/VRM/Material.swift Outdated Show resolved Hide resolved
Sources/VRMKit/VRM/VRMFileProtocol.swift Outdated Show resolved Hide resolved
Sources/VRMKit/VRMLoader.swift Outdated Show resolved Hide resolved
Tests/VRMKitTests/VRMKitTests.swift Outdated Show resolved Hide resolved
Copy link
Owner

@tattn tattn left a comment

Choose a reason for hiding this comment

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

このコメントの確認後にマージしたいと思います!
お手すきのときにご確認ください!

Sources/VRMKit/VRM/Material.swift Outdated Show resolved Hide resolved
Sources/VRMKit/VRM/Node.swift Outdated Show resolved Hide resolved
Copy link
Owner

@tattn tattn left a comment

Choose a reason for hiding this comment

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

VRM 1.0のパース実装のPRありがとうございます 😄
問題ないと思いますので、マージします!

@tattn tattn merged commit 9f5c247 into tattn:main Apr 18, 2024
1 check passed
@is0263rf is0263rf deleted the support-vrm1 branch April 21, 2024 23:56
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.

None yet

2 participants