Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Swift transposed version of a different color approach on all sides of a `SCNBox` (
/// Generate `SCNMaterial` that is the specified color
func material(withColor color : UIColor) -> SCNMaterial {
let material = SCNMaterial();
material.diffuse.contents = color
material.locksAmbientWithDiffuse = true
return material
let greenMaterial = material(withColor:
let redMaterial = material(withColor:
let blueMaterial = material(withColor:
let yellowMaterial = material(withColor: UIColor.yellow)
let purpleMaterial = material(withColor: UIColor.purple)
let magentaMaterial = material(withColor: UIColor.magenta)
cube.materials = [greenMaterial, redMaterial, blueMaterial, yellowMaterial, purpleMaterial, magentaMaterial];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.