-
-
Notifications
You must be signed in to change notification settings - Fork 32
Introduce VRMKitRuntime #43
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| public enum BlendShapeKey: Hashable { | ||
| case preset(BlendShapePreset) | ||
| case custom(String) | ||
|
|
||
| public var isPreset: Bool { | ||
| switch self { | ||
| case .preset: return true | ||
| case .custom: return false | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// VRM 0.x Blend Shape Preset | ||
| public enum BlendShapePreset: String { | ||
| case unknown | ||
| case neutral | ||
| case a | ||
| case i | ||
| case u | ||
| case e | ||
| case o | ||
| case blink | ||
| case joy | ||
| case angry | ||
| case sorrow | ||
| case fun | ||
| case lookUp = "lookup" | ||
| case lookDown = "lookdown" | ||
| case lookLeft = "lookleft" | ||
| case lookRight = "lookright" | ||
| case blinkL = "blink_l" | ||
| case blinkR = "blink_r" | ||
|
|
||
| package init(name: String) { | ||
| self = BlendShapePreset(rawValue: name.lowercased()) ?? .unknown | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
Sources/VRMRealityKit/Extensions/GLTF+.swift → Sources/VRMKitRuntime/GLTF+Runtime.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import simd | ||
|
|
||
| public extension SIMD3 where Scalar == Float { | ||
| var normalized: SIMD3 { | ||
| simd_normalize(self) | ||
| } | ||
|
|
||
| var length: Scalar { | ||
| simd_length(self) | ||
| } | ||
|
|
||
| var length_squared: Scalar { | ||
| simd_length_squared(self) | ||
| } | ||
|
|
||
| mutating func normalize() { | ||
| self = normalized | ||
| } | ||
| } | ||
|
|
||
| public extension simd_quatf { | ||
| static func * (_ left: simd_quatf, _ right: SIMD3<Float>) -> SIMD3<Float> { | ||
| simd_act(left, right) | ||
| } | ||
| } | ||
|
|
||
| public let quat_identity_float = simd_quatf(matrix_identity_float4x4) | ||
|
|
||
| public func cross(_ left: SIMD3<Float>, _ right: SIMD3<Float>) -> SIMD3<Float> { | ||
| simd_cross(left, right) | ||
| } | ||
|
|
||
| public func normal(_ v0: SIMD3<Float>, _ v1: SIMD3<Float>, _ v2: SIMD3<Float>) -> SIMD3<Float> { | ||
| let e1 = v1 - v0 | ||
| let e2 = v2 - v0 | ||
| return simd_normalize(simd_cross(e1, e2)) | ||
| } | ||
tattn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| public protocol UnityTransformCompatible { | ||
| associatedtype CompatibleType | ||
| var utx: CompatibleType { get } | ||
| } | ||
|
|
||
| public final class UnityTransform<Base> { | ||
| package let base: Base | ||
|
|
||
| public init(_ base: Base) { | ||
| self.base = base | ||
| } | ||
| } | ||
|
|
||
| public extension UnityTransformCompatible { | ||
| var utx: UnityTransform<Self> { | ||
| UnityTransform(self) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 1 addition & 18 deletions
19
Sources/VRMRealityKit/Extensions/Entity+UnityTransform.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @_exported import VRMKitRuntime | ||
tattn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.