iOS 8, Scene Kit @ 60FPS, programmed in F#, using Xamarin.iOS

I have the best job in the world:

[code lang=”fsharp”]
namespace SceneKitFSharp

open System
open MonoTouch.UIKit
open MonoTouch.Foundation
open MonoTouch.SceneKit
open MonoTouch.CoreAnimation

type MySceneKitController () =
inherit UIViewController()

override this.ViewDidLoad () =
let scene = new SCNScene ()

//Positions everyone!
let boxNode = new SCNNode ()
boxNode.Geometry <- new SCNBox(
Width = 1.0F,
Height = 1.0F,
Length = 1.0F,
ChamferRadius = 0.02f
)
scene.RootNode.AddChildNode (boxNode)

let material = new SCNMaterial ()
material.Diffuse.Contents <- UIImage.FromFile ("textureX.png")
material.Specular.Contents <- UIColor.Gray
material.LocksAmbientWithDiffuse <- true
boxNode.Geometry.FirstMaterial <- material

//Lights!
let lightNode = new SCNNode()
lightNode.Light <- new SCNLight ()
lightNode.Light.LightType <- SCNLightType.Omni
lightNode.Position <- new SCNVector3 (0.0F, 10.0F, 10.0F)
scene.RootNode.AddChildNode (lightNode)

let ambientLightNode = new SCNNode ()
ambientLightNode.Light <- new SCNLight ()
ambientLightNode.Light.LightType <- SCNLightType.Ambient
ambientLightNode.Light.Color <- UIColor.DarkGray
scene.RootNode.AddChildNode (ambientLightNode)

//Camera!
let cameraNode = new SCNNode ()
cameraNode.Camera <- new SCNCamera ()
scene.RootNode.AddChildNode (cameraNode)
cameraNode.Position <- new SCNVector3 (0.0F, 0.0F, 3.0F)

// Action!
let animation = new CABasicAnimation(
KeyPath = "rotation"
)
let t = new SCNVector4 (1.0F, 1.0F, 0.0F, float32 (Math.PI * 2.0))
animation.To <- NSValue.FromVector (t)

animation.Duration <- float 5.0F
animation.RepeatCount <- float32 Double.MaxValue //repeat forever
boxNode.AddAnimation(animation,new NSString("rotation"))

let scnView = new SCNView(UIScreen.MainScreen.Bounds)
scnView.Scene <- scene
scnView.AllowsCameraControl <- true
scnView.ShowsStatistics <- true
scnView.BackgroundColor <- UIColor.Black

this.View <- scnView

[<Register ("AppDelegate")>]
type AppDelegate () =
inherit UIApplicationDelegate ()

// This method is invoked when the application is ready to run.
override this.FinishedLaunching (app, options) =
let window = new UIWindow (UIScreen.MainScreen.Bounds)
window.RootViewController <- new MySceneKitController()
window.MakeKeyAndVisible ()
true

module Main =
[<EntryPoint>]
let main args =
UIApplication.Main (args, null, "AppDelegate")
0

[/code]

IMG_0272

photo