SvrfGLTFSceneKit
从 magicien/GLTFSceneKit 分支的 glTF loader 在 SceneKit,继续开发这个优秀的库。
安装
CocoaPods
使用将以下内容添加到您的Podfile
pod 'SvrfGLTFSceneKit'
手动
从 发布版本 中下载 SvrfGLTFSceneKit_vX.X.X.zip。
使用方法
Swift
import SvrfGLTFSceneKit
var scene: SCNScene
do {
let sceneSource = try GLTFSceneSource(named: "art.scnassets/Box/glTF/Box.gltf")
scene = try sceneSource.scene()
} catch {
print("\(error.localizedDescription)")
return
}
Objective-C
@import SvrfGLTFSceneKit;
GLTFSceneSource *source = [[GLTFSceneSource alloc] initWithURL:url options:nil];
NSError *error;
SCNScene *scene = [source sceneWithOptions:nil error:&error];
if (error != nil) {
NSLog(@"%@", error);
return;
}