Collada to SceneKit for iOS

I have a collada file, it contains a cube from which I export data to a file (raw bytes only), and I import bytes into iOS. Everything is fine, I studied the data, and everything looks the same for the tops on iOS and osx.

However, when I look at the Collada file, the normals are very different from what SceneKit has

In SceneKit, the normals are 0, -1, or 1. In the Collada file, I have -2.831 ..., - 1.31 ... etc.

Any insight was appreciated,

thanks

D

+4
source share
1 answer

In Swift, the following code loads the collada.dae file into the scene:

let url = NSBundle.mainBundle().URLForResource("scene", withExtension: "dae") var error: NSErrorPointer? = nil let scene = SCNScene.sceneWithURL(url, options: nil, error: error!) 

In Obj-C:

 NSURL *url = [[NSBundle mainBundle] urlForResource:@"scene" withExtension:@"dae"]; NSError *error; SCNScene *scene = [SCNScene sceneWithURL:url options:nil error:&error]; 

See http://adcdownload.apple.com//videos/wwdc_2012__sd/session_504__introducing_scene_kit.mov

(I understood the conversion to Swift using XCode dandy autocomplete.)

+1
source

Source: https://habr.com/ru/post/1486392/


All Articles