Created
October 19, 2016 17:34
-
-
Save chamons/0e2e0e8e04e0725cf802b17cf21643c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void ViewDidLoad () | |
{ | |
base.ViewDidLoad (); | |
SCNView view = new SCNView (View.Frame); | |
view.Scene = new SCNScene (); | |
var sphere = SCNSphere.Create (10); | |
var node = new SCNNode () { Geometry = sphere }; | |
view.Scene.RootNode.Add (node); | |
view.AutoenablesDefaultLighting = true; | |
view.AllowsCameraControl = true; | |
sphere.FirstMaterial.Diffuse.ContentColor = NSColor.Blue; | |
Task.Factory.StartNew (() => | |
{ | |
for (int i = 0; i < 1000; ++i) | |
{ | |
BeginInvokeOnMainThread (() => | |
{ | |
int x = (int)Math.Floor (i * 2.4); | |
if (i % 4 == 0) | |
sphere.FirstMaterial.Diffuse.ContentColor = NSColor.FromRgba (x, 0, 0, 192); | |
else if (i % 4 == 1) | |
sphere.FirstMaterial.Diffuse.ContentColor = NSColor.FromRgba (0, x, 0, 192); | |
else if (i % 4 == 2) | |
sphere.FirstMaterial.Diffuse.ContentColor = NSColor.FromRgba (0, 0, x, 192); | |
else | |
sphere.FirstMaterial.Diffuse.ContentColor = NSColor.FromRgba (x, x, x, 192); | |
}); | |
System.Threading.Thread.Sleep (25); | |
} | |
GC.Collect (2); | |
}); | |
View.AddSubview (view); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment