Beispiel #1
0
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			switch (index) {
			case 0:
				// Set the slide's title
				// And make the bullets we will add later to fade in
				TextManager.SetTitle ("Outline");
				TextManager.FadesIn = true;
				break;
			case 1:
				TextManager.AddBulletAtLevel ("Scene graph", 0);
				break;
			case 2:
				TextManager.AddBulletAtLevel ("Build an application with Scene Kit", 0);
				break;
			case 3:
				TextManager.AddBulletAtLevel ("Extending with OpenGL", 0);
				break;
			case 4:
				TextManager.AddBulletAtLevel ("What’s new in OS X 10.9", 0);
				break;
			case 5:
				TextManager.AddBulletAtLevel ("Performance notes", 0);
				break;
			}
		}
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 0.5f;

			switch (index) {
			case 0:
				TextManager.SetTitle ("Materials");
				TextManager.SetSubtitle ("Code example");

				TextManager.AddCode ("#// Access the geometry attribute of a node \n"
				+ "var geometry = node.#Geometry#; \n\n"
				+ "// Create a new \"red\" material \n"
				+ "var aMaterial = #SCNMaterial.Create ()#; \n"
				+ "aMaterial.#Diffuse#.Contents = NSColor.Red; \n\n"
				+ "// Set this material to our geometry \n"
				+ "geometry.#FirstMaterial# = aMaterial;#");

				TextManager.HighlightCodeChunks (null);
				break;
			case 1:
				TextManager.HighlightCodeChunks (new int[] { 0 });
				break;
			case 2:
				TextManager.HighlightCodeChunks (new int[] { 1, 2 });
				break;
			case 3:
				TextManager.HighlightCodeChunks (new int[] { 3 });
				break;
			}

			SCNTransaction.Commit ();
		}
Beispiel #3
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            // Set the slide's title
            TextManager.SetTitle ("Labs");

            // Add two labs
            var lab1TitleNode = Utils.SCBoxNode ("Scene Kit Lab", new CGRect (-375, -35, 750, 70), NSColor.FromCalibratedWhite (0.15f, 1.0f), 0.0f, false);
            lab1TitleNode.Scale = new SCNVector3 (0.02f, 0.02f, 0.02f);
            lab1TitleNode.Position = new SCNVector3 (-2.8f, 30.7f, 10.0f);
            lab1TitleNode.Rotation = new SCNVector4 (1, 0, 0, (float)(Math.PI));
            lab1TitleNode.Opacity = 0.0f;

            var lab2TitleNode = (SCNNode)lab1TitleNode.Copy ();
            lab2TitleNode.Position = new SCNVector3 (-2.8f, 29.2f, 10.0f);

            ContentNode.AddChildNode (lab1TitleNode);
            ContentNode.AddChildNode (lab2TitleNode);

            var lab1InfoNode = AddLabInfoNode ("\nGraphics and Games Lab A\nTuesday 4:00PM", 30.7f);
            var lab2InfoNode = AddLabInfoNode ("\nGraphics and Games Lab A\nWednesday 9:00AM", 29.2f);

            var delayInSeconds = 0.75;
            var popTime = new DispatchTime (DispatchTime.Now, (long)(delayInSeconds * Utils.NSEC_PER_SEC));
            DispatchQueue.MainQueue.DispatchAfter (popTime, () => {
                SCNTransaction.Begin ();
                SCNTransaction.AnimationDuration = 1;
                lab1TitleNode.Opacity = lab2TitleNode.Opacity = 1.0f;
                lab1TitleNode.Rotation = lab2TitleNode.Rotation = new SCNVector4 (1, 0, 0, 0);
                lab1InfoNode.Opacity = lab2InfoNode.Opacity = 1.0f;
                lab1InfoNode.Rotation = lab2InfoNode.Rotation = new SCNVector4 (0, 1, 0, 0);
                SCNTransaction.Commit ();
            });
        }
Beispiel #4
0
 public override void WillOrderOut(PresentationViewController presentationViewController)
 {
     SCNTransaction.Begin();
     // Switch the light off
     LightNode.Light = null;
     SCNTransaction.Commit();
 }
 public override void DidOrderIn(PresentationViewController presentationViewController)
 {
     SCNTransaction.Begin();
     SCNTransaction.AnimationDuration = 1.0f;
     sceneGraphDiagramNode.Opacity    = 1.0f;
     SCNTransaction.Commit();
 }
Beispiel #6
0
		public override void WillOrderOut (PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			// Switch the light off
			LightNode.Light = null;
			SCNTransaction.Commit ();
		}
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Creating a Scene");

			TextManager.AddBulletAtLevel ("Creating programmatically", 0);
			TextManager.AddBulletAtLevel ("Loading a scene from a file", 0);
		}
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Set the slide's title and subtitle and add some text
            TextManager.SetTitle("Animations");
            TextManager.SetSubtitle("Implicit animations");

            TextManager.AddCode("#// Begin a transaction \n"
                                + "#SCNTransaction#.Begin (); \n"
                                + "#SCNTransaction#.AnimationDuration = 2.0f; \n\n"
                                + "// Change properties \n"
                                + "aNode.#Opacity# = 1.0f; \n"
                                + "aNode.#Rotation# = \n"
                                + " new SCNVector4 (0, 1, 0, NMath.PI * 4); \n\n"
                                + "// Commit the transaction \n"
                                + "SCNTransaction.#Commit ()#;#");

            // A simple torus that we will animate to illustrate the code
            AnimatedNode          = SCNNode.Create();
            AnimatedNode.Position = new SCNVector3(10, 7, 0);

            // Use an extra node that we can tilt it and cumulate that with the animation
            var torusNode = SCNNode.Create();

            torusNode.Geometry = SCNTorus.Create(4.0f, 1.5f);
            torusNode.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI * 0.7f));
            torusNode.Geometry.FirstMaterial.Diffuse.Contents    = NSColor.Cyan;
            torusNode.Geometry.FirstMaterial.Specular.Contents   = NSColor.White;
            torusNode.Geometry.FirstMaterial.Reflective.Contents = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/envmap", "jpg"));
            torusNode.Geometry.FirstMaterial.FresnelExponent     = 0.7f;

            AnimatedNode.AddChildNode(torusNode);
            ContentNode.AddChildNode(AnimatedNode);
        }
Beispiel #9
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Set the slide's title and subtitle and add some text
            TextManager.SetTitle("Animations");
            TextManager.SetSubtitle("Explicit animations");

            TextManager.AddCode("#// Create an animation \n"
                                + "animation = #CABasicAnimation#.FromKeyPath (\"rotation\"); \n\n"
                                + "// Configure the animation \n"
                                + "animation.#Duration# = 2.0f; \n"
                                + "animation.#To# = NSValue.FromVector (new SCNVector4 (0, 1, 0, NMath.PI * 2)); \n"
                                + "animation.#RepeatCount# = float.MaxValue; \n\n"
                                + "// Play the animation \n"
                                + "aNode.#AddAnimation #(animation, \"myAnimation\");#");

            // A simple torus that we will animate to illustrate the code
            AnimatedNode          = SCNNode.Create();
            AnimatedNode.Position = new SCNVector3(9, 5.7f, 16);

            // Use an extra node that we can tilt it and cumulate that with the animation
            var torusNode = SCNNode.Create();

            torusNode.Geometry = SCNTorus.Create(4.0f, 1.5f);
            torusNode.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI * 0.5f));
            torusNode.Geometry.FirstMaterial.Diffuse.Contents    = NSColor.Cyan;
            torusNode.Geometry.FirstMaterial.Specular.Contents   = NSColor.White;
            torusNode.Geometry.FirstMaterial.Reflective.Contents = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/envmap", "jpg"));
            torusNode.Geometry.FirstMaterial.FresnelExponent     = 0.7f;

            AnimatedNode.AddChildNode(torusNode);
            ContentNode.AddChildNode(AnimatedNode);
        }
Beispiel #10
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Creating a Scene");

            TextManager.AddBulletAtLevel("Creating programmatically", 0);
            TextManager.AddBulletAtLevel("Loading a scene from a file", 0);
        }
Beispiel #11
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Create the font and the materials that will be shared among the features in the word cloud
			Font = NSFont.FromFontName ("Myriad Set BoldItalic", 50) != null ? NSFont.FromFontName ("Myriad Set BoldItalic", 50) : NSFont.FromFontName ("Avenir Heavy Oblique", 50);

			var frontAndBackMaterial = SCNMaterial.Create ();
			var sideMaterial = SCNMaterial.Create ();
			sideMaterial.Diffuse.Contents = NSColor.DarkGray;

			Materials = new SCNMaterial[] { frontAndBackMaterial, sideMaterial, frontAndBackMaterial };

			// Add different features to the word cloud
			PlaceFeature ("Export to DAE", new CGPoint (10, -8), 0);
			PlaceFeature ("OpenGL Core Profile", new CGPoint (-16, -7), 0.05f);
			PlaceFeature ("Warmup", new CGPoint (-12, -10), 0.1f);
			PlaceFeature ("Constraints", new CGPoint (-10, 6), 0.15f);
			PlaceFeature ("Custom projection", new CGPoint (4, 9), 0.2f);
			PlaceFeature ("Skinning", new CGPoint (-4, 8), 0.25f);
			PlaceFeature ("Morphing", new CGPoint (-3, -8), 0.3f);
			PlaceFeature ("Performance Statistics", new CGPoint (-1, 6), 0.35f);
			PlaceFeature ("CIFilters", new CGPoint (1, 5), 0.85f);
			PlaceFeature ("GLKit Math", new CGPoint (3, -10), 0.45f);
			PlaceFeature ("Depth of Field", new CGPoint (-0.5f, 0), 0.47f);
			PlaceFeature ("Animation Events", new CGPoint (5, 3), 0.50f);
			PlaceFeature ("Shader Modifiers", new CGPoint (7, 2), 0.95f);
			PlaceFeature ("GOBO", new CGPoint (-10, 1), 0.60f);
			PlaceFeature ("Ray testing", new CGPoint (-8, 0), 0.65f);
			PlaceFeature ("Skybox", new CGPoint (8, -1), 0.7f);
			PlaceFeature ("Fresnel", new CGPoint (6, -2), 0.75f);
			PlaceFeature ("SCNShape", new CGPoint (-6, -3), 0.8f);
			PlaceFeature ("Levels of detail", new CGPoint (-11, 3), 0.9f);
			PlaceFeature ("Animation blending", new CGPoint (-2, -5), 1);
		}
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			// Animate by default
			SCNTransaction.Begin ();

			switch (index) {
			case 0:
				// Disable animations for first step
				SCNTransaction.AnimationDuration = 0;

				// Initially dim the torus
				AnimatedNode.Opacity = 0.25f;

				TextManager.HighlightCodeChunks (null);
				break;
			case 1:
				TextManager.HighlightCodeChunks (new int[] { 0, 1 });
				break;
			case 2:
				TextManager.HighlightCodeChunks (new int[] { 2, 3 });
				break;
			case 3:
				TextManager.HighlightCodeChunks (new int[] { 4 });

				// Animate implicitly
				SCNTransaction.AnimationDuration = 2.0f;
				AnimatedNode.Opacity = 1.0f;
				AnimatedNode.Rotation = new SCNVector4 (0, 1, 0, (float)(Math.PI * 4));
				break;
			}

			SCNTransaction.Commit ();
		}
Beispiel #13
0
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			// Set the slide's title
			TextManager.SetTitle ("Labs");

			// Add two labs
			var lab1TitleNode = Utils.SCBoxNode ("Scene Kit Lab", new CGRect (-375, -35, 750, 70), NSColor.FromCalibratedWhite (0.15f, 1.0f), 0.0f, false);
			lab1TitleNode.Scale = new SCNVector3 (0.02f, 0.02f, 0.02f);
			lab1TitleNode.Position = new SCNVector3 (-2.8f, 30.7f, 10.0f);
			lab1TitleNode.Rotation = new SCNVector4 (1, 0, 0, (float)(Math.PI));
			lab1TitleNode.Opacity = 0.0f;

			var lab2TitleNode = (SCNNode)lab1TitleNode.Copy ();
			lab2TitleNode.Position = new SCNVector3 (-2.8f, 29.2f, 10.0f);

			ContentNode.AddChildNode (lab1TitleNode);
			ContentNode.AddChildNode (lab2TitleNode);

			var lab1InfoNode = AddLabInfoNode ("\nGraphics and Games Lab A\nTuesday 4:00PM", 30.7f);
			var lab2InfoNode = AddLabInfoNode ("\nGraphics and Games Lab A\nWednesday 9:00AM", 29.2f);

			var delayInSeconds = 0.75;
			var popTime = new DispatchTime (DispatchTime.Now, (long)(delayInSeconds * Utils.NSEC_PER_SEC));
			DispatchQueue.MainQueue.DispatchAfter (popTime, () => {
				SCNTransaction.Begin ();
				SCNTransaction.AnimationDuration = 1;
				lab1TitleNode.Opacity = lab2TitleNode.Opacity = 1.0f;
				lab1TitleNode.Rotation = lab2TitleNode.Rotation = new SCNVector4 (1, 0, 0, 0);
				lab1InfoNode.Opacity = lab2InfoNode.Opacity = 1.0f;
				lab1InfoNode.Rotation = lab2InfoNode.Rotation = new SCNVector4 (0, 1, 0, 0);
				SCNTransaction.Commit ();
			});
		}
Beispiel #14
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Load the scene
            var intermediateNode = SCNNode.Create();

            intermediateNode.Position = new SCNVector3(6, 9, 0);
            intermediateNode.Scale    = new SCNVector3(1.4f, 1, 1);
            GroundNode.AddChildNode(intermediateNode);

            MapNode          = Utils.SCAddChildNode(intermediateNode, "Map", "Scenes/map/foldingMap", 25);
            MapNode.Position = new SCNVector3(0, 0, 0);
            MapNode.Opacity  = 0.0f;

            // Use a bunch of shader modifiers to simulate ambient occlusion when the map is folded
            var geomFile         = NSBundle.MainBundle.PathForResource("Shaders/mapGeometry", "shader");
            var fragFile         = NSBundle.MainBundle.PathForResource("Shaders/mapFragment", "shader");
            var lightFile        = NSBundle.MainBundle.PathForResource("Shaders/mapLighting", "shader");
            var geometryModifier = File.ReadAllText(geomFile);
            var fragmentModifier = File.ReadAllText(fragFile);
            var lightingModifier = File.ReadAllText(lightFile);

            MapNode.Geometry.ShaderModifiers = new SCNShaderModifiers {
                EntryPointGeometry      = geometryModifier,
                EntryPointFragment      = fragmentModifier,
                EntryPointLightingModel = lightingModifier
            };
        }
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Load the character and add it to the scene
			var heroNode = Utils.SCAddChildNode (GroundNode, "heroGroup", "Scenes/hero/hero", 0.0f);

			heroNode.Scale = new SCNVector3 (0.023f, 0.023f, 0.023f);
			heroNode.Position = new SCNVector3 (0.0f, 0.0f, 15.0f);
			heroNode.Rotation = new SCNVector4 (1.0f, 0.0f, 0.0f, -(float)(Math.PI / 2));

			GroundNode.AddChildNode (heroNode);

			// Convert sceneTime-based animations into systemTime-based animations.
			// Animations loaded from DAE files will play according to the `currentTime` property of the scene renderer if this one is playing
			// (see the SCNSceneRenderer protocol). Here we don't play a specific DAE so we want the animations to animate as soon as we add
			// them to the scene (i.e have them to play according the time of the system when the animation was added).

			HeroSkeletonNode = heroNode.FindChildNode ("skeleton", true);

			foreach (var animationKey in HeroSkeletonNode.GetAnimationKeys ()) {
				// Find all the animations. Make them system time based and repeat forever.
				// And finally replace the old animation.

				var animation = HeroSkeletonNode.GetAnimation (animationKey);
				animation.UsesSceneTimeBase = false;
				animation.RepeatCount = float.MaxValue;

				HeroSkeletonNode.AddAnimation (animation, animationKey);
			}

			// Load other animations so that we will use them later
			SetAnimation (CharacterAnimation.Attack, "attackID", "attack");
			SetAnimation (CharacterAnimation.Die, "DeathID", "death");
			SetAnimation (CharacterAnimation.Walk, "WalkID", "walk");
		}
Beispiel #16
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Create a node to own the "sign" model, make it to be close to the camera, rotate by 90 degree because it's oriented with z as the up axis
            var intermediateNode = SCNNode.Create();

            intermediateNode.Position = new SCNVector3(0, 0, 7);
            intermediateNode.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI / 2));
            GroundNode.AddChildNode(intermediateNode);

            // Load the "sign" model
            var signNode = Utils.SCAddChildNode(intermediateNode, "sign", "Scenes/intersection/intersection", 30);

            signNode.Position = new SCNVector3(4, -2, 0.05f);

            // Re-parent every node that holds a camera otherwise they would inherit the scale from the "sign" model.
            // This is not a problem except that the scale affects the zRange of cameras and so it would be harder to get the transition from one camera to another right
            var cameraNodes = new NSMutableArray();

            foreach (SCNNode child in signNode)
            {
                if (child.Camera != null)
                {
                    cameraNodes.Add(child);
                }
            }

            for (nuint i = 0; i < cameraNodes.Count; i++)
            {
                var cameraNode             = new SCNNode(cameraNodes.ValueAt((uint)i));
                var previousWorldTransform = cameraNode.WorldTransform;
                intermediateNode.AddChildNode(cameraNode);                  // re-parent
                cameraNode.Transform = intermediateNode.ConvertTransformFromNode(previousWorldTransform, null);
                cameraNode.Scale     = new SCNVector3(1, 1, 1);
            }
        }
Beispiel #17
0
        public void GoTo(object sender, EventArgs e)
        {
            var item  = sender as NSMenuItem;
            var index = (NSNumber)(item.RepresentedObject);

            PresentationViewController.GoToSlide(index.Int32Value);
        }
Beispiel #18
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Load the character and add it to the scene
            var heroNode = Utils.SCAddChildNode(GroundNode, "heroGroup", "Scenes/hero/hero", 0.0f);

            heroNode.Scale    = new SCNVector3(0.023f, 0.023f, 0.023f);
            heroNode.Position = new SCNVector3(0.0f, 0.0f, 15.0f);
            heroNode.Rotation = new SCNVector4(1.0f, 0.0f, 0.0f, -(float)(Math.PI / 2));

            GroundNode.AddChildNode(heroNode);

            // Convert sceneTime-based animations into systemTime-based animations.
            // Animations loaded from DAE files will play according to the `currentTime` property of the scene renderer if this one is playing
            // (see the SCNSceneRenderer protocol). Here we don't play a specific DAE so we want the animations to animate as soon as we add
            // them to the scene (i.e have them to play according the time of the system when the animation was added).

            HeroSkeletonNode = heroNode.FindChildNode("skeleton", true);

            foreach (var animationKey in HeroSkeletonNode.GetAnimationKeys())
            {
                // Find all the animations. Make them system time based and repeat forever.
                // And finally replace the old animation.

                var animation = HeroSkeletonNode.GetAnimation(animationKey);
                animation.UsesSceneTimeBase = false;
                animation.RepeatCount       = float.MaxValue;

                HeroSkeletonNode.AddAnimation(animation, animationKey);
            }

            // Load other animations so that we will use them later
            SetAnimation(CharacterAnimation.Attack, "attackID", "attack");
            SetAnimation(CharacterAnimation.Die, "DeathID", "death");
            SetAnimation(CharacterAnimation.Walk, "WalkID", "walk");
        }
Beispiel #19
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Create a node to own the "sign" model, make it to be close to the camera, rotate by 90 degree because it's oriented with z as the up axis
			var intermediateNode = SCNNode.Create ();
			intermediateNode.Position = new SCNVector3 (0, 0, 7);
			intermediateNode.Rotation = new SCNVector4 (1, 0, 0, -(float)(Math.PI / 2));
			GroundNode.AddChildNode (intermediateNode);

			// Load the "sign" model
			var signNode = Utils.SCAddChildNode (intermediateNode, "sign", "Scenes/intersection/intersection", 30);
			signNode.Position = new SCNVector3 (4, -2, 0.05f);

			// Re-parent every node that holds a camera otherwise they would inherit the scale from the "sign" model.
			// This is not a problem except that the scale affects the zRange of cameras and so it would be harder to get the transition from one camera to another right
			var cameraNodes = new List<SCNNode> ();
			foreach (SCNNode child in signNode) {
				if (child.Camera != null)
					cameraNodes.Add (child);
			}

			for (var i = 0; i < cameraNodes.Count; i++) {
				var cameraNode = cameraNodes [i];
				var previousWorldTransform = cameraNode.WorldTransform;
				intermediateNode.AddChildNode (cameraNode); // re-parent
				cameraNode.Transform = intermediateNode.ConvertTransformFromNode (previousWorldTransform, null);
				cameraNode.Scale = new SCNVector3 (1, 1, 1);
			}
		}
Beispiel #20
0
 public override void WillOrderOut(PresentationViewController presentationViewController)
 {
     SCNTransaction.Begin();
     // Restore the default point of view before leaving this slide
     ((SCNView)presentationViewController.View).PointOfView = presentationViewController.CameraNode;
     SCNTransaction.Commit();
 }
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Set the slide's title and subtitle and add some text
			TextManager.SetTitle ("Animations");
			TextManager.SetSubtitle ("Implicit animations");

			TextManager.AddCode ("#// Begin a transaction \n"
			+ "#SCNTransaction#.Begin (); \n"
			+ "#SCNTransaction#.AnimationDuration = 2.0f; \n\n"
			+ "// Change properties \n"
			+ "aNode.#Opacity# = 1.0f; \n"
			+ "aNode.#Rotation# = \n"
			+ " new SCNVector4 (0, 1, 0, NMath.PI * 4); \n\n"
			+ "// Commit the transaction \n"
			+ "SCNTransaction.#Commit ()#;#");

			// A simple torus that we will animate to illustrate the code
			AnimatedNode = SCNNode.Create ();
			AnimatedNode.Position = new SCNVector3 (10, 7, 0);

			// Use an extra node that we can tilt it and cumulate that with the animation
			var torusNode = SCNNode.Create ();
			torusNode.Geometry = SCNTorus.Create (4.0f, 1.5f);
			torusNode.Rotation = new SCNVector4 (1, 0, 0, -(float)(Math.PI * 0.7f));
			torusNode.Geometry.FirstMaterial.Diffuse.Contents = NSColor.Cyan;
			torusNode.Geometry.FirstMaterial.Specular.Contents = NSColor.White;
			torusNode.Geometry.FirstMaterial.Reflective.Contents = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/envmap", "jpg"));
			torusNode.Geometry.FirstMaterial.FresnelExponent = 0.7f;

			AnimatedNode.AddChildNode (torusNode);
			ContentNode.AddChildNode (AnimatedNode);
		}
Beispiel #22
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Load the scene
			var intermediateNode = SCNNode.Create ();
			intermediateNode.Position = new SCNVector3 (6, 9, 0);
			intermediateNode.Scale = new SCNVector3 (1.4f, 1, 1);
			GroundNode.AddChildNode (intermediateNode);

			MapNode = Utils.SCAddChildNode (intermediateNode, "Map", "Scenes/map/foldingMap", 25);
			MapNode.Position = new SCNVector3 (0, 0, 0);
			MapNode.Opacity = 0.0f;

			// Use a bunch of shader modifiers to simulate ambient occlusion when the map is folded
			var geomFile = NSBundle.MainBundle.PathForResource ("Shaders/mapGeometry", "shader");
			var fragFile = NSBundle.MainBundle.PathForResource ("Shaders/mapFragment", "shader");
			var lightFile = NSBundle.MainBundle.PathForResource ("Shaders/mapLighting", "shader");
			var geometryModifier = File.ReadAllText (geomFile);
			var fragmentModifier = File.ReadAllText (fragFile);
			var lightingModifier = File.ReadAllText (lightFile);

			MapNode.Geometry.ShaderModifiers = new SCNShaderModifiers { 
				EntryPointGeometry = geometryModifier,
				EntryPointFragment = fragmentModifier,
				EntryPointLightingModel = lightingModifier
			};
		}
Beispiel #23
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Create the font and the materials that will be shared among the features in the word cloud
            Font = NSFont.FromFontName("Myriad Set BoldItalic", 50) != null?NSFont.FromFontName("Myriad Set BoldItalic", 50) : NSFont.FromFontName("Avenir Heavy Oblique", 50);

            var frontAndBackMaterial = SCNMaterial.Create();
            var sideMaterial         = SCNMaterial.Create();

            sideMaterial.Diffuse.Contents = NSColor.DarkGray;

            Materials = new SCNMaterial[] { frontAndBackMaterial, sideMaterial, frontAndBackMaterial };

            // Add different features to the word cloud
            PlaceFeature("Export to DAE", new CGPoint(10, -8), 0);
            PlaceFeature("OpenGL Core Profile", new CGPoint(-16, -7), 0.05f);
            PlaceFeature("Warmup", new CGPoint(-12, -10), 0.1f);
            PlaceFeature("Constraints", new CGPoint(-10, 6), 0.15f);
            PlaceFeature("Custom projection", new CGPoint(4, 9), 0.2f);
            PlaceFeature("Skinning", new CGPoint(-4, 8), 0.25f);
            PlaceFeature("Morphing", new CGPoint(-3, -8), 0.3f);
            PlaceFeature("Performance Statistics", new CGPoint(-1, 6), 0.35f);
            PlaceFeature("CIFilters", new CGPoint(1, 5), 0.85f);
            PlaceFeature("GLKit Math", new CGPoint(3, -10), 0.45f);
            PlaceFeature("Depth of Field", new CGPoint(-0.5f, 0), 0.47f);
            PlaceFeature("Animation Events", new CGPoint(5, 3), 0.50f);
            PlaceFeature("Shader Modifiers", new CGPoint(7, 2), 0.95f);
            PlaceFeature("GOBO", new CGPoint(-10, 1), 0.60f);
            PlaceFeature("Ray testing", new CGPoint(-8, 0), 0.65f);
            PlaceFeature("Skybox", new CGPoint(8, -1), 0.7f);
            PlaceFeature("Fresnel", new CGPoint(6, -2), 0.75f);
            PlaceFeature("SCNShape", new CGPoint(-6, -3), 0.8f);
            PlaceFeature("Levels of detail", new CGPoint(-11, 3), 0.9f);
            PlaceFeature("Animation blending", new CGPoint(-2, -5), 1);
        }
Beispiel #24
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            switch (index)
            {
            case 0:
                // Set the slide's title
                // And make the bullets we will add later to fade in
                TextManager.SetTitle("Outline");
                TextManager.FadesIn = true;
                break;

            case 1:
                TextManager.AddBulletAtLevel("Scene graph", 0);
                break;

            case 2:
                TextManager.AddBulletAtLevel("Build an application with Scene Kit", 0);
                break;

            case 3:
                TextManager.AddBulletAtLevel("Extending with OpenGL", 0);
                break;

            case 4:
                TextManager.AddBulletAtLevel("What’s new in OS X 10.9", 0);
                break;

            case 5:
                TextManager.AddBulletAtLevel("Performance notes", 0);
                break;
            }
        }
Beispiel #25
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            switch (index)
            {
            case 0:
                // Set the slide's title and subtile
                TextManager.SetTitle("Performance");
                TextManager.SetSubtitle("Texturing");

                // From now on, every text we add will fade in
                TextManager.FadesIn = true;
                break;

            case 1:
                TextManager.AddBulletAtLevel("Avoid unnecessarily large images", 0);
                break;

            case 2:
                TextManager.AddBulletAtLevel("Lock ambient and diffuse", 0);
                TextManager.AddCode("#aMaterial.#LocksAmbientWithDiffuse# = true;#");
                break;

            case 3:
                TextManager.AddBulletAtLevel("Use mipmaps", 0);
                TextManager.AddCode("#aMaterial.Diffuse.#MipFilter# = #SCNFilterMode.Linear#;#");
                break;
            }
        }
		public override void DidOrderIn (PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 1.0f;
			sceneGraphDiagramNode.Opacity = 1.0f;
			SCNTransaction.Commit ();
		}
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Set the slide's title and subtitle and add some text
			TextManager.SetTitle ("Animations");
			TextManager.SetSubtitle ("Explicit animations");

			TextManager.AddCode ("#// Create an animation \n"
			+ "animation = #CABasicAnimation#.FromKeyPath (\"rotation\"); \n\n"
			+ "// Configure the animation \n"
			+ "animation.#Duration# = 2.0f; \n"
			+ "animation.#To# = NSValue.FromVector (new SCNVector4 (0, 1, 0, NMath.PI * 2)); \n"
			+ "animation.#RepeatCount# = float.MaxValue; \n\n"
			+ "// Play the animation \n"
			+ "aNode.#AddAnimation #(animation, \"myAnimation\");#");

			// A simple torus that we will animate to illustrate the code
			AnimatedNode = SCNNode.Create ();
			AnimatedNode.Position = new SCNVector3 (9, 5.7f, 16);

			// Use an extra node that we can tilt it and cumulate that with the animation
			var torusNode = SCNNode.Create ();
			torusNode.Geometry = SCNTorus.Create (4.0f, 1.5f);
			torusNode.Rotation = new SCNVector4 (1, 0, 0, -(float)(Math.PI * 0.5f));
			torusNode.Geometry.FirstMaterial.Diffuse.Contents = NSColor.Cyan;
			torusNode.Geometry.FirstMaterial.Specular.Contents = NSColor.White;
			torusNode.Geometry.FirstMaterial.Reflective.Contents = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/envmap", "jpg"));
			torusNode.Geometry.FirstMaterial.FresnelExponent = 0.7f;

			AnimatedNode.AddChildNode (torusNode);
			ContentNode.AddChildNode (AnimatedNode);
		}
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            switch (index)
            {
            case 0:
                // Set the slide's title and subtitle and add some text.
                TextManager.SetTitle("Performance");
                TextManager.SetSubtitle("Flattening");

                TextManager.AddBulletAtLevel("Flatten node tree into single node", 0);
                TextManager.AddBulletAtLevel("Minimize draw calls", 0);

                TextManager.AddCode("#// Flatten node hierarchy \n"
                                    + "var flattenedNode = aNode.#FlattenedClone# ();#");

                break;

            case 1:
                // Discard the text and show a 2D image.
                // Animate the image's position when it appears.

                TextManager.FlipOutText(SlideTextManager.TextType.Code);
                TextManager.FlipOutText(SlideTextManager.TextType.Bullet);

                var imageNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/flattening", "png"), 20, false);
                imageNode.Position = new SCNVector3(0, 4.8f, 16);
                GroundNode.AddChildNode(imageNode);

                SCNTransaction.Begin();
                SCNTransaction.AnimationDuration = 1;
                imageNode.Position = new SCNVector3(0, 4.8f, 8);
                SCNTransaction.Commit();
                break;
            }
        }
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			switch (index) {
			case 0:
				// Set the slide's title and subtitle and add some text.
				TextManager.SetTitle ("Performance");
				TextManager.SetSubtitle ("Flattening");

				TextManager.AddBulletAtLevel ("Flatten node tree into single node", 0);
				TextManager.AddBulletAtLevel ("Minimize draw calls", 0);

				TextManager.AddCode ("#// Flatten node hierarchy \n"
				+ "var flattenedNode = aNode.#FlattenedClone# ();#");

				break;
			case 1:
				// Discard the text and show a 2D image.
				// Animate the image's position when it appears.

				TextManager.FlipOutText (SlideTextManager.TextType.Code);
				TextManager.FlipOutText (SlideTextManager.TextType.Bullet);

				var imageNode = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/flattening", "png"), 20, false);
				imageNode.Position = new SCNVector3 (0, 4.8f, 16);
				GroundNode.AddChildNode (imageNode);

				SCNTransaction.Begin ();
				SCNTransaction.AnimationDuration = 1;
				imageNode.Position = new SCNVector3 (0, 4.8f, 8);
				SCNTransaction.Commit ();
				break;
			}
		}
Beispiel #30
0
 public override void WillOrderOut(PresentationViewController presentationViewController)
 {
     SCNTransaction.Begin();
     SCNTransaction.AnimationDuration = 1;
     presentationViewController.CameraNode.Constraints = null;
     presentationViewController.SpotLight.Constraints  = null;
     SCNTransaction.Commit();
 }
Beispiel #31
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Shader Modifiers");

            TextManager.AddBulletAtLevel("Inject custom GLSL code", 0);
            TextManager.AddBulletAtLevel("Combines with Scene Kit’s shaders", 0);
            TextManager.AddBulletAtLevel("Inject at specific stages", 0);
        }
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Shader Modifiers");

			TextManager.AddBulletAtLevel ("Inject custom GLSL code", 0);
			TextManager.AddBulletAtLevel ("Combines with Scene Kit’s shaders", 0);
			TextManager.AddBulletAtLevel ("Inject at specific stages", 0);
		}
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Rendering a Scene");

			TextManager.AddBulletAtLevel ("Assign the scene to the renderer", 0);
			TextManager.AddBulletAtLevel ("Modifications of the scene graph are automatically reflected", 0);

			TextManager.AddCode ("#// Assign the scene \nSCNView.#Scene# = aScene;#");
		}
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Extending Scene Kit with OpenGL");
            TextManager.SetSubtitle("Scene delegate rendering");

            TextManager.AddBulletAtLevel("Custom GL code, free of constraints", 0);
            TextManager.AddBulletAtLevel("Before and/or after scene rendering", 0);
            TextManager.AddBulletAtLevel("Works with SCNView, SCNLayer and SCNRenderer", 0);
        }
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Extending Scene Kit with OpenGL");

            TextManager.AddBulletAtLevel("Scene delegate rendering", 0);
            TextManager.AddBulletAtLevel("Node delegate rendering", 0);
            TextManager.AddBulletAtLevel("Material custom program", 0);
            TextManager.AddBulletAtLevel("Shader modifiers", 0);
        }
Beispiel #36
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Rendering a Scene");

            TextManager.AddBulletAtLevel("Assign the scene to the renderer", 0);
            TextManager.AddBulletAtLevel("Modifications of the scene graph are automatically reflected", 0);

            TextManager.AddCode("#// Assign the scene \nSCNView.#Scene# = aScene;#");
        }
Beispiel #37
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Scene Manipulation");
            TextManager.SetSubtitle("Animating");

            TextManager.AddBulletAtLevel("Properties are animatable", 0);
            TextManager.AddBulletAtLevel("Implicit and explicit animations", 0);
            TextManager.AddBulletAtLevel("Same programming model as Core Animation", 0);
        }
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Loading a DAE");
			TextManager.SetSubtitle ("Sample code");

			TextManager.AddCode ("#// Load a DAE"
			+ "\n"
			+ "var scene = SCNScene.#FromFile# (\"yourPath\");#");
		}
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Extending Scene Kit with OpenGL");
			TextManager.SetSubtitle ("Scene delegate rendering");

			TextManager.AddBulletAtLevel ("Custom GL code, free of constraints", 0);
			TextManager.AddBulletAtLevel ("Before and/or after scene rendering", 0);
			TextManager.AddBulletAtLevel ("Works with SCNView, SCNLayer and SCNRenderer", 0);
		}
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Extending Scene Kit with OpenGL");

			TextManager.AddBulletAtLevel ("Scene delegate rendering", 0);
			TextManager.AddBulletAtLevel ("Node delegate rendering", 0);
			TextManager.AddBulletAtLevel ("Material custom program", 0);
			TextManager.AddBulletAtLevel ("Shader modifiers", 0);
		}
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Loading a DAE");
            TextManager.SetSubtitle("Sample code");

            TextManager.AddCode("#// Load a DAE"
                                + "\n"
                                + "var scene = SCNScene.#FromFile# (\"yourPath\");#");
        }
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Scene Manipulation");
			TextManager.SetSubtitle ("Animating");

			TextManager.AddBulletAtLevel ("Properties are animatable", 0);
			TextManager.AddBulletAtLevel ("Implicit and explicit animations", 0);
			TextManager.AddBulletAtLevel ("Same programming model as Core Animation", 0);
		}
Beispiel #43
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            SCNTransaction.Begin();
            SCNTransaction.AnimationDuration = 0;

            switch (index)
            {
            case 0:
                // Set the slide's title and subtile and add some text
                TextManager.SetTitle("Node Attributes");
                TextManager.SetSubtitle("Lights");

                TextManager.AddBulletAtLevel("SCNLight", 0);
                TextManager.AddBulletAtLevel("Four light types", 0);
                TextManager.AddBulletAtLevel("Omni", 1);
                TextManager.AddBulletAtLevel("Directional", 1);
                TextManager.AddBulletAtLevel("Spot", 1);
                TextManager.AddBulletAtLevel("Ambient", 1);
                break;

            case 1:
                // Add some code
                var codeExampleNode = TextManager.AddCode("#aNode.#Light# = SCNLight.Create (); \naNode.Light.LightType = SCNLightType.Omni;#");
                codeExampleNode.Position = new SCNVector3(14, 11, 1);

                // Add a light to the scene
                LightNode                 = SCNNode.Create();
                LightNode.Light           = SCNLight.Create();
                LightNode.Light.LightType = SCNLightType.Omni;
                LightNode.Light.Color     = NSColor.Black;             // initially off
                LightNode.Light.SetAttribute(new NSNumber(30), SCNLightAttribute.AttenuationStartKey);
                LightNode.Light.SetAttribute(new NSNumber(40), SCNLightAttribute.AttenuationEndKey);
                LightNode.Position = new SCNVector3(5, 3.5f, 0);
                ContentNode.AddChildNode(LightNode);

                // Load two images to help visualize the light (on and off)
                LightOffImageNode        = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/light-off", "tiff"), 7, false);
                LightOnImageNode         = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/light-on", "tiff"), 7, false);
                LightOnImageNode.Opacity = 0;

                LightNode.AddChildNode(LightOnImageNode);
                LightNode.AddChildNode(LightOffImageNode);
                break;

            case 2:
                // Switch the light on
                SCNTransaction.Begin();
                SCNTransaction.AnimationDuration = 1;
                LightNode.Light.Color            = NSColor.FromCalibratedRgba(1, 1, 0.8f, 1);
                LightOnImageNode.Opacity         = 1.0f;
                LightOffImageNode.Opacity        = 0.0f;
                SCNTransaction.Commit();
                break;
            }
            SCNTransaction.Commit();
        }
Beispiel #44
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            SCNTransaction.Begin();

            switch (index)
            {
            case 0:
                // Set the slide's title and subtitle and add some text
                TextManager.SetTitle("Skinning");

                TextManager.AddBulletAtLevel("Animate characters", 0);
                TextManager.AddBulletAtLevel("Deform geometries with a skeleton", 0);
                TextManager.AddBulletAtLevel("Joints and bones", 0);

                // Animate the character
                CharacterNode.AddAnimation(IdleAnimationGroup, new NSString("idleAnimation"));

                // The character is hidden. Wait a little longer before showing it
                // otherwise it may slow down the transition from the previous slide
                var delayInSeconds = 1.5;
                var popTime        = new DispatchTime(DispatchTime.Now, (long)(delayInSeconds * Utils.NSEC_PER_SEC));
                DispatchQueue.MainQueue.DispatchAfter(popTime, () => {
                    SCNTransaction.Begin();
                    SCNTransaction.AnimationDuration = 0;
                    CharacterNode.Hidden             = false;
                    CharacterNode.Opacity            = 0;
                    SCNTransaction.Commit();

                    SCNTransaction.Begin();
                    SCNTransaction.AnimationDuration       = 1.5;
                    SCNTransaction.AnimationTimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseIn);
                    CharacterNode.Opacity = 1;
                    SCNTransaction.Commit();
                });
                break;

            case 1:
                SCNTransaction.AnimationDuration = 1.5f;
                //TODO SetShowsBones (true);
                break;

            case 2:
                CharacterNode.AddAnimation(AnimationGroup1, new NSString("animation"));
                break;

            case 3:
                SCNTransaction.AnimationDuration = 1.5f;
                //TODO SetShowsBones (false);
                break;

            case 4:
                CharacterNode.AddAnimation(AnimationGroup1, new NSString("animation"));
                break;
            }
            SCNTransaction.Commit();
        }
Beispiel #45
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            // Animate by default
            SCNTransaction.Begin();

            switch (index)
            {
            case 0:
                // Disable animations for first step
                SCNTransaction.AnimationDuration = 0;

                // Initially dim the torus
                AnimatedNode.Opacity = 0.0f;

                TextManager.HighlightCodeChunks(null);
                break;

            case 1:
                TextManager.HighlightCodeChunks(new int[] { 0 });
                break;

            case 2:
                TextManager.HighlightCodeChunks(new int[] { 1, 2, 3 });
                break;

            case 3:
                TextManager.HighlightCodeChunks(new int[] { 4, 5 });
                break;

            case 4:
                SCNTransaction.AnimationDuration = 1.0f;

                // Show the torus
                AnimatedNode.Opacity = 1.0f;

                // Animate explicitly
                var animation = CABasicAnimation.FromKeyPath("rotation");
                animation.Duration    = 2.0f;
                animation.To          = NSValue.FromVector(new SCNVector4(0, 1, 0, (float)(Math.PI * 2)));
                animation.RepeatCount = float.MaxValue;
                AnimatedNode.AddAnimation(animation, new NSString("myAnimation"));

                SCNTransaction.Begin();
                SCNTransaction.AnimationDuration = 1;
                // Dim the text
                TextManager.TextNode.Opacity = 0.75f;

                presentationViewController.CameraHandle.Position = presentationViewController.CameraHandle.ConvertPositionToNode(new SCNVector3(9, 8, 15), presentationViewController.CameraHandle.ParentNode);
                presentationViewController.CameraPitch.Rotation  = new SCNVector4(1, 0, 0, -(float)(Math.PI / 10));

                SCNTransaction.Commit();
                break;
            }

            SCNTransaction.Commit();
        }
Beispiel #46
0
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 1.5f;

			var cameraNode = presentationViewController.CameraNode;

			switch (index) {
			case 0:
				break;
			case 1:
				// Add a code snippet
				TextManager.AddCode ("#aCamera.#FocalDistance# = 16.0f; \n"
				+ "aCamera.#FocalBlurRadius# = 8.0f;#");
				break;
			case 2:
				// Turn on DOF to illustrate the code snippet
				cameraNode.Camera.FocalDistance = 16;
				cameraNode.Camera.FocalSize = 1.5f;
				cameraNode.Camera.Aperture = 0.3f;
				cameraNode.Camera.FocalBlurRadius = 8;
				break;
			case 3:
				// Focus far away
				cameraNode.Camera.FocalDistance = 35;
				cameraNode.Camera.FocalSize = 4;
				cameraNode.Camera.Aperture = 0.1f;

				// and update the code snippet
				TextManager.FadeOutText (SlideTextManager.TextType.Code);
				TextManager.AddEmptyLine ();
				TextManager.AddCode ("#aCamera.#FocalDistance# = #35.0f#; \n"
				+ "aCamera.#FocalBlurRadius# = 8.0f;#");
				break;
			case 4:
				// Remove the code
				TextManager.FadeOutText (SlideTextManager.TextType.Subtitle);
				TextManager.FadeOutText (SlideTextManager.TextType.Code);

				// Move the camera and adjust tje focal distance
				presentationViewController.CameraHandle.Position = presentationViewController.CameraHandle.ConvertPositionToNode (new SCNVector3 (0, -3, -6), presentationViewController.CameraHandle.ParentNode);
				cameraNode.Camera.FocalDistance = 27;

				// Move the light back a little
				presentationViewController.MainLight.Position = presentationViewController.MainLight.ConvertPositionToNode (new SCNVector3 (0, 3, 6), presentationViewController.MainLight.ParentNode);
				break;
			case 5:
				// Focus near
				cameraNode.Camera.FocalDistance = 10;
				cameraNode.Camera.FocalSize = 1;
				cameraNode.Camera.Aperture = 0.3f;
				break;
			}

			SCNTransaction.Commit ();
		}
Beispiel #47
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Scene Kit Editor");
			TextManager.AddBulletAtLevel ("Built into Xcode", 0);
			TextManager.AddBulletAtLevel ("Scene information", 0);
			TextManager.AddBulletAtLevel ("Preview final rendering", 0);
			TextManager.AddBulletAtLevel ("Scene graph inspection", 0);
			TextManager.AddBulletAtLevel ("Adjust lightning and materials", 0);
			TextManager.AddBulletAtLevel ("Preview animations and performance", 0);
		}
Beispiel #48
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Set the slide's title and subtitle and add some text
			TextManager.SetTitle ("Performance");
			TextManager.SetSubtitle ("Lighting");

			TextManager.AddBulletAtLevel ("Minimize the number of lights", 0);
			TextManager.AddBulletAtLevel ("Prefer static than dynamic shadows", 0);
			TextManager.AddBulletAtLevel ("Use material's \"multiply\" property", 0);
		}
Beispiel #49
0
 public override void SetupSlide(PresentationViewController presentationViewController)
 {
     TextManager.SetTitle("Scene Kit Editor");
     TextManager.AddBulletAtLevel("Built into Xcode", 0);
     TextManager.AddBulletAtLevel("Scene information", 0);
     TextManager.AddBulletAtLevel("Preview final rendering", 0);
     TextManager.AddBulletAtLevel("Scene graph inspection", 0);
     TextManager.AddBulletAtLevel("Adjust lightning and materials", 0);
     TextManager.AddBulletAtLevel("Preview animations and performance", 0);
 }
Beispiel #50
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Set the slide's title and subtitle and add some text
            TextManager.SetTitle("Performance");
            TextManager.SetSubtitle("Lighting");

            TextManager.AddBulletAtLevel("Minimize the number of lights", 0);
            TextManager.AddBulletAtLevel("Prefer static than dynamic shadows", 0);
            TextManager.AddBulletAtLevel("Use material's \"multiply\" property", 0);
        }
Beispiel #51
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			var labelNode = Utils.SCLabelNode ("XAMARIN 2014", Utils.LabelSize.Normal, false);
			labelNode.Position = new SCNVector3 (-3.6f, 29.5f, 20);

			// Reducing the text's flatness makes it smoother, less tesselated
			var text = (SCNText)labelNode.Geometry;
			text.Flatness = 0.1f;

			ContentNode.AddChildNode (labelNode);
		}
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Scene Manipulation");
			TextManager.SetSubtitle ("Code example");

			TextManager.AddCode ("#// Move a node to another position. \n"
			+ "aNode.#Position# = new SCNVector3 (0, 0, 0); \n"
			+ "aNode.#Scale#    = new SCNVector3 (2, 2, 2); \n"
			+ "aNode.#Rotation# = new SCNVector4 (x, y, z, angle); \n"
			+ "aNode.#Opacity#  = 0.5f;#");
		}
Beispiel #53
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Scene Manipulation");
            TextManager.SetSubtitle("Code example");

            TextManager.AddCode("#// Move a node to another position. \n"
                                + "aNode.#Position# = new SCNVector3 (0, 0, 0); \n"
                                + "aNode.#Scale#    = new SCNVector3 (2, 2, 2); \n"
                                + "aNode.#Rotation# = new SCNVector4 (x, y, z, angle); \n"
                                + "aNode.#Opacity#  = 0.5f;#");
        }
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Set the slide's title and subtitle and add some text
			TextManager.SetTitle ("Scene Graph");
			TextManager.SetSubtitle ("Scene");
			TextManager.AddBulletAtLevel ("SCNScene", 0);
			TextManager.AddBulletAtLevel ("Starting point", 0);

			// Setup the diagram
			var diagramNode = SlideSceneGraph.SharedScenegraphDiagramNode ();
			GroundNode.AddChildNode (diagramNode);
		}
Beispiel #55
0
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 0;

			switch (index) {
			case 0:
				// Set the slide's title and subtile and add some text
				TextManager.SetTitle ("Node Attributes");
				TextManager.SetSubtitle ("Lights");

				TextManager.AddBulletAtLevel ("SCNLight", 0);
				TextManager.AddBulletAtLevel ("Four light types", 0);
				TextManager.AddBulletAtLevel ("Omni", 1);
				TextManager.AddBulletAtLevel ("Directional", 1);
				TextManager.AddBulletAtLevel ("Spot", 1);
				TextManager.AddBulletAtLevel ("Ambient", 1);
				break;
			case 1:
				// Add some code
				var codeExampleNode = TextManager.AddCode ("#aNode.#Light# = SCNLight.Create (); \naNode.Light.LightType = SCNLightType.Omni;#");
				codeExampleNode.Position = new SCNVector3 (14, 11, 1);

				// Add a light to the scene
				LightNode = SCNNode.Create ();
				LightNode.Light = SCNLight.Create ();
				LightNode.Light.LightType = SCNLightType.Omni;
				LightNode.Light.Color = NSColor.Black; // initially off
				LightNode.Light.SetAttribute (new NSNumber (30), SCNLightAttribute.AttenuationStartKey);
				LightNode.Light.SetAttribute (new NSNumber (40), SCNLightAttribute.AttenuationEndKey);
				LightNode.Position = new SCNVector3 (5, 3.5f, 0);
				ContentNode.AddChildNode (LightNode);

				// Load two images to help visualize the light (on and off)
				LightOffImageNode = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/light-off", "tiff"), 7, false);
				LightOnImageNode = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/light-on", "tiff"), 7, false);
				LightOnImageNode.Opacity = 0;

				LightNode.AddChildNode (LightOnImageNode);
				LightNode.AddChildNode (LightOffImageNode);
				break;
			case 2:
				// Switch the light on
				SCNTransaction.Begin ();
				SCNTransaction.AnimationDuration = 1;
				LightNode.Light.Color = NSColor.FromCalibratedRgba (1, 1, 0.8f, 1);
				LightOnImageNode.Opacity = 1.0f;
				LightOffImageNode.Opacity = 0.0f;
				SCNTransaction.Commit ();
				break;
			}
			SCNTransaction.Commit ();
		}
Beispiel #56
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Scene Manipulation");
            TextManager.SetSubtitle("Basics");

            TextManager.AddBulletAtLevel("Retrieve nodes", 0);
            TextManager.AddBulletAtLevel("Move, scale and rotate", 0);
            TextManager.AddBulletAtLevel("Animate", 0);
            TextManager.AddBulletAtLevel("Change colors and images", 0);
            TextManager.AddBulletAtLevel("Change lighting", 0);
            TextManager.AddBulletAtLevel("Clone", 0);
        }
Beispiel #57
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			RedColor = NSColor.FromDeviceRgba (168.0f / 255.0f, 21.0f / 255.0f, 0.0f / 255.0f, 1);
			GreenColor = NSColor.FromDeviceRgba (154.0f / 255.0f, 197.0f / 255.0f, 58.0f / 255.0f, 1);
			BlueColor = NSColor.FromDeviceRgba (49.0f / 255.0f, 80.0f / 255.0f, 201.0f / 255.0f, 1);
			PurpleColor = NSColor.FromDeviceRgba (190.0f / 255.0f, 56.0f / 255.0f, 243.0f / 255.0f, 1);

			// Create the diagram but hide it
			DiagramNode = CloningDiagramNode ();
			DiagramNode.Opacity = 0.0f;
			ContentNode.AddChildNode (DiagramNode);
		}
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Scene Manipulation");
			TextManager.SetSubtitle ("Basics");

			TextManager.AddBulletAtLevel ("Retrieve nodes", 0);
			TextManager.AddBulletAtLevel ("Move, scale and rotate", 0);
			TextManager.AddBulletAtLevel ("Animate", 0);
			TextManager.AddBulletAtLevel ("Change colors and images", 0);
			TextManager.AddBulletAtLevel ("Change lighting", 0);
			TextManager.AddBulletAtLevel ("Clone", 0);
		}
Beispiel #59
0
 public void PopulateGoMenu()
 {
     for (int i = 0; i < PresentationViewController.NumberOfSlides; i++)
     {
         var slideName     = PresentationViewController.ClassOfSlide(i).ToString();
         var splitedString = slideName.Split('.');
         var title         = i + " " + splitedString[1].Substring(5);
         var item          = new NSMenuItem(title, GoTo);
         item.RepresentedObject = new NSNumber(i);
         GoMenu.AddItem(item);
     }
 }
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Creating a Scene");

			TextManager.AddBulletAtLevel ("Creating programmatically", 0);
			TextManager.AddBulletAtLevel ("Loading a scene from a file", 0);

			var delayInSeconds = 1.0;
			var popTime = new DispatchTime (DispatchTime.Now, (long)(delayInSeconds * Utils.NSEC_PER_SEC));
			DispatchQueue.MainQueue.DispatchAfter (popTime, () => {
				TextManager.HighlightBullet (1);
			});
		}