-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add blendShapes and humanoid bone support to VRM + bugfixes (#55)
* Add blendShapes support * Add humanoid bone support * Fix GLTFSceneSource initializer error handling * Remove the submodule * SPM: add workaround for Foundation.Bundle to enable swift previews (#51) * SPM: add workaround for Foundation.Bundle to enable swift previews * SPM: move shaders into Resources/ directory to make Xcode Previews happy * Add TEXCOORD_2 and TEXCOORD_3 to GLTFTypes * Fix the shader file references * Change VRM meta data to optional * Remove print() for debug Co-authored-by: Andrew Breckenridge <asbreckenridge@me.com>
- Loading branch information
Showing
19 changed files
with
328 additions
and
170 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,3 +0,0 @@ | ||
[submodule "schema"] | ||
path = schema | ||
url = https://github.com/KhronosGroup/glTF.git | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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,68 @@ | ||
// | ||
// GLTFSceneKit+BundleFinder.swift | ||
// | ||
// | ||
// Created by Andrew Breckenridge on 9/6/21. | ||
// | ||
|
||
/// required to enable Swift previews in Xcode 12: https://github.com/pointfreeco/isowords/discussions/104 | ||
|
||
import Foundation | ||
|
||
#if !DEBUG | ||
extension Bundle { | ||
static var module_workaround: Bundle = { | ||
#if SWIFT_PACKAGE | ||
return .module | ||
#else | ||
return Bundle(for: GLTFUnarchiver.self) | ||
#endif | ||
}() | ||
} | ||
#else | ||
private let moduleName = "GLTFSceneKit_GLTFSceneKit" | ||
|
||
extension Foundation.Bundle { | ||
static var module_workaround: Bundle = { | ||
#if !SWIFT_PACKAGE | ||
return Bundle(for: GLTFUnarchiver.self) | ||
#else | ||
/* The name of your local package, prepended by "LocalPackages_" for iOS and "PackageName_" for macOS. You may have same PackageName and TargetName*/ | ||
let bundleNameIOS = "LocalPackages_\(moduleName)" | ||
let bundleNameMacOs = "PackageName_\(moduleName)" | ||
let andrewSBBundleName = moduleName | ||
|
||
let candidates = [ | ||
/* Bundle should be present here when the package is linked into an App. */ | ||
Bundle.main.resourceURL, | ||
/* Bundle should be present here when the package is linked into a framework. */ | ||
Bundle(for: GLTFUnarchiver.self).resourceURL, | ||
/* For command-line tools. */ | ||
Bundle.main.bundleURL, | ||
|
||
// AndrewSB reverse engineered this one | ||
Bundle(for: GLTFUnarchiver.self).resourceURL?.appendingPathComponent("Bundle").appendingPathComponent("Application"), | ||
|
||
/* Bundle should be present here when running previews from a different package (this is the path to "…/Debug-iphonesimulator/"). */ | ||
Bundle(for: GLTFUnarchiver.self).resourceURL?.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent(), | ||
Bundle(for: GLTFUnarchiver.self).resourceURL?.deletingLastPathComponent().deletingLastPathComponent(), | ||
] | ||
|
||
for candidate in candidates { | ||
let bundlePathiOS = candidate?.appendingPathComponent(bundleNameIOS + ".bundle") | ||
let bundlePathMacOS = candidate?.appendingPathComponent(bundleNameMacOs + ".bundle") | ||
let andrewSBBundlePath = candidate?.appendingPathComponent(andrewSBBundleName + ".bundle") | ||
|
||
if let bundle = bundlePathiOS.flatMap(Bundle.init(url:)) { | ||
return bundle | ||
} else if let bundle = bundlePathMacOS.flatMap(Bundle.init(url:)) { | ||
return bundle | ||
} else if let bundle = andrewSBBundlePath.flatMap(Bundle.init(url:)) { | ||
return bundle | ||
} | ||
} | ||
fatalError("unable to find bundle") | ||
#endif | ||
}() | ||
} | ||
#endif |
This file contains 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 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
Oops, something went wrong.