Reputation: 21966
I'm trying to add a bump map to a material and since apparently there is no way to do it with a plain SCNMaterial, I just tried to use a MDLMaterial instead, and then convert it to a SCNMaterial. There is a method in the Apple documentation for this:
convenience init(MDLMaterial mdlMaterial: MDLMaterial)
But I keep getting an error:
/Users/ramy/Documents/Swift/Space Shooter/Space Shooter/Util.swift:50:26: Incorrect argument label in call (have 'MDLMaterial:', expected 'coder:')
It doesn't seem to find the method. I tried in Objective-C and it still doesn't find it.
Edit
I was already importing ModelIO:
import ModelIO
If I switch to:
import SceneKit.ModelIO
Nothing changes, I still can't find the method.
Upvotes: 1
Views: 383
Reputation: 13462
you'll need to import the bridging header to see these methods:
// Objective-C
#import <SceneKit/ModelIO.h>
// Swift
import SceneKit.ModelIO
That said you shouldn't have to use Model I/O. Have you tried the normal
material property on SCNMaterial
?
Also note that Model I/O was designed as an interexchange format and not all that it can represent is supported by SceneKit. If SceneKit APIs don't expose what you're looking for, there's little to no chance that using an intermediate Model I/O object will help.
Upvotes: 3