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.Red;
			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);
		}
Example #2
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            SCNTransaction.Begin();
            switch (index)
            {
            case 0:
                break;

            case 1:
                // Switch to camera1
                SCNTransaction.AnimationDuration = 2.0f;
                ((SCNView)presentationViewController.View).PointOfView = ContentNode.FindChildNode("camera1", true);
                break;

            case 2:
                // Switch to camera2
                SCNTransaction.AnimationDuration = 2.0f;
                ((SCNView)presentationViewController.View).PointOfView = ContentNode.FindChildNode("camera2", true);
                break;

            case 3:
                // Switch back to the default camera
                SCNTransaction.AnimationDuration = 1.0f;
                ((SCNView)presentationViewController.View).PointOfView = presentationViewController.CameraNode;
                break;
            }
            SCNTransaction.Commit();
        }
Example #3
0
        public void GoTo(object sender, EventArgs e)
        {
            var item  = sender as NSMenuItem;
            var index = (NSNumber)(item.RepresentedObject);

            PresentationViewController.GoToSlide(index.Int32Value);
        }
Example #4
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Add some text
			TextManager.SetTitle ("Loading a 3D Scene");
			TextManager.SetSubtitle ("DAE Documents");

			NodesToDim = new List <SCNNode> ();

			TextManager.AddBulletAtLevel ("Geometries", 0);
			TextManager.AddBulletAtLevel ("Animations", 0);
			NodesToDim.Add (TextManager.AddBulletAtLevel ("Textures", 0));
			NodesToDim.Add (TextManager.AddBulletAtLevel ("Lighting", 0));
			NodesToDim.Add (TextManager.AddBulletAtLevel ("Cameras", 0));
			NodesToDim.Add (TextManager.AddBulletAtLevel ("Skinning", 0));
			NodesToDim.Add (TextManager.AddBulletAtLevel ("Morphing", 0));

			// And an image resting on the ground
			DaeIcon = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/dae file icon", "png"), 10, false);
			DaeIcon.Position = new SCNVector3 (6, 4.5f, 1);
			GroundNode.AddChildNode (DaeIcon);

			AbcIcon = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/abc file icon", "png"), 10, false);
			AbcIcon.Position = new SCNVector3 (6, 4.5f, 30);
			GroundNode.AddChildNode (AbcIcon);
		}
Example #5
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();
 }
Example #6
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Set the slide's title and subtitle and add some text
            TextManager.SetTitle("Materials");
            TextManager.SetSubtitle("Property contents");

            TextManager.AddBulletAtLevel("Color", 0);
            TextManager.AddBulletAtLevel("CGColorRef / NSColor / UIColor", 0);

            var node = SCNNode.Create();

            node.Name     = "material-cube";
            node.Geometry = SCNBox.Create(W, W, W, W * 0.02f);

            Material = node.Geometry.FirstMaterial;
            Material.Diffuse.Contents = NSColor.Red;

            Object = node;

            node.Position = new SCNVector3(8, 11, 0);
            ContentNode.AddChildNode(node);
            node.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy((float)Math.PI * 2, new SCNVector3(0.4f, 1, 0), 4)));

            MaterialLayerSlideReference = this;
        }
Example #7
0
		public override void DidOrderIn (PresentationViewController presentationViewController)
		{
			var banana = Utils.SCAddChildNode (ContentNode, "banana", "Scenes.scnassets/banana/banana", 5);
			banana.Rotation = new SCNVector4 (1, 0, 0, -(float)(Math.PI / 2));

			banana.RunAction (SCNAction.RepeatActionForever (SCNAction.RotateBy (0, NMath.PI * 2, 0, 1.5f)));
			banana.Position = new SCNVector3 (2.5f, 5, 10);
			var gaussianBlurFilter = new CIGaussianBlur () { Radius = 10 };
			gaussianBlurFilter.SetDefaults ();
			banana.Filters = new CIFilter[] { gaussianBlurFilter };

			banana = (SCNNode)banana.Copy ();
			ContentNode.AddChildNode (banana);
			banana.Position = new SCNVector3 (6, 5, 10);
			var pixellateFilter = new CIPixellate ();
			pixellateFilter.SetDefaults ();
			banana.Filters = new CIFilter[] { pixellateFilter };

			banana = (SCNNode)banana.Copy ();
			ContentNode.AddChildNode (banana);
			banana.Position = new SCNVector3 (9.5f, 5, 10);
			var edgeWorkFilter = new CIEdgeWork ();
			edgeWorkFilter.SetDefaults ();
			banana.Filters = new CIFilter[] { edgeWorkFilter };
		}
Example #8
0
 public override void SetupSlide(PresentationViewController presentationViewController)
 {
     TextManager.SetTitle("Particles");
     TextManager.SetSubtitle("SCNParticleSystem");
     TextManager.AddBulletAtLevel("Achieve a large number of effects", 0);
     TextManager.AddBulletAtLevel("3D particle editor built into Xcode", 0);
 }
Example #9
0
        public override void WillOrderOut(PresentationViewController presentationViewController)
        {
            ((SCNView)presentationViewController.View).Scene.PhysicsWorld.Speed = 0;

            foreach (var node in Dices)
            {
                node.RemoveFromParentNode();
            }

            foreach (var node in Balls)
            {
                node.RemoveFromParentNode();
            }

            foreach (var node in Shapes)
            {
                node.RemoveFromParentNode();
            }

            foreach (var node in Meshes)
            {
                node.RemoveFromParentNode();
            }

            foreach (var node in Hinges)
            {
                node.RemoveFromParentNode();
            }
        }
Example #10
0
		public override void WillOrderOut (PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			// Switch the light off
			LightNode.Light = null;
			SCNTransaction.Commit ();
		}
Example #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("Techniques", new CGPoint(10, -8), 0);
            PlaceFeature("SpriteKit materials", new CGPoint(-16, -7), 0.05f);
            PlaceFeature("Inverse Kinematics", new CGPoint(-12, -6), 0.1f);
            PlaceFeature("Actions", new CGPoint(-10, 6), 0.15f);
            PlaceFeature("SKTexture", new CGPoint(4, 9), 0.2f);
            PlaceFeature("JavaScript", new CGPoint(-4, 8), 0.25f);
            PlaceFeature("Alembic", new CGPoint(-3, -8), 0.3f);
            PlaceFeature("OpenSubdiv", new CGPoint(-1, 6), 0.35f);
            PlaceFeature("Assets catalog", new CGPoint(1, 5), 0.85f);
            PlaceFeature("SIMD bridge", new CGPoint(3, -6), 0.45f);
            PlaceFeature("Physics", new CGPoint(-0.5f, 0), 0.47f);
            PlaceFeature("Vehicle", new CGPoint(5, 3), 0.50f);
            PlaceFeature("Fog", new CGPoint(7, 2), 0.95f);
            PlaceFeature("SpriteKit Overlays", new CGPoint(-10, 1), 0.60f);
            PlaceFeature("Particles", new CGPoint(-13, -1), 0.65f);
            PlaceFeature("Forward shadows", new CGPoint(8, -1), 0.7f);
            PlaceFeature("Snapshot", new CGPoint(6, -2), 0.75f);
            PlaceFeature("Physics Fields", new CGPoint(-6, -3), 0.8f);
            PlaceFeature("Archiving", new CGPoint(-11, 3), 0.9f);
            PlaceFeature("Performance tools", new CGPoint(-2, -5), 1);
        }
Example #12
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Scene Kit");
			TextManager.SetSubtitle ("Introduction");
			TextManager.AddBulletAtLevel ("High level API for 3D integration", 0);
			TextManager.AddBulletAtLevel ("Data visualization", 1);
			TextManager.AddBulletAtLevel ("User Interface", 1);
			TextManager.AddBulletAtLevel ("Casual Games", 1);

			var redColor = NSColor.FromDeviceRgba (168.0f / 255.0f, 21.0f / 255.0f, 1.0f / 255.0f, 1);
			var grayColor = NSColor.Gray;
			var greenColor = NSColor.FromDeviceRgba (105.0f / 255.0f, 145.0f / 255.0f, 14.0f / 255.0f, 1);
			var orangeColor = NSColor.Orange;
			var purpleColor = NSColor.FromDeviceRgba (152.0f / 255.0f, 57.0f / 255.0f, 189.0f / 255.0f, 1);

			Boxes = new List<SCNNode> ();

			AddBox ("Cocoa", new CGRect (0, 0, 500, 70), 3, grayColor);
			AddBox ("Core Image", new CGRect (0, 0, 100, 70), 2, greenColor);
			AddBox ("Core Animation", new CGRect (390, 0, 110, 70), 2, greenColor);
			AddBox ("Sprite Kit", new CGRect (250, 0, 135, 70), 2, greenColor);
			AddBox ("Scene Kit", new CGRect (105, 0, 140, 70), 2, orangeColor);
			AddBox ("OpenGL / OpenGL ES", new CGRect (0, 0, 500, 70), 1, purpleColor);
			AddBox ("Graphics Hardware", new CGRect (0, 0, 500, 70), 0, redColor);
		}
        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.Red;
            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)
		{
			// 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 ();
		}
Example #15
0
        public override void DidOrderIn(PresentationViewController presentationViewController)
        {
            var banana = Utils.SCAddChildNode(ContentNode, "banana", "Scenes.scnassets/banana/banana", 5);

            banana.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI / 2));

            banana.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0, NMath.PI * 2, 0, 1.5f)));
            banana.Position = new SCNVector3(2.5f, 5, 10);
            var gaussianBlurFilter = new CIGaussianBlur()
            {
                Radius = 10
            };

            gaussianBlurFilter.SetDefaults();
            banana.Filters = new CIFilter[] { gaussianBlurFilter };

            banana = (SCNNode)banana.Copy();
            ContentNode.AddChildNode(banana);
            banana.Position = new SCNVector3(6, 5, 10);
            var pixellateFilter = new CIPixellate();

            pixellateFilter.SetDefaults();
            banana.Filters = new CIFilter[] { pixellateFilter };

            banana = (SCNNode)banana.Copy();
            ContentNode.AddChildNode(banana);
            banana.Position = new SCNVector3(9.5f, 5, 10);
            var filter = CIFilter.FromName("CIEdgeWork");

            filter.SetDefaults();
            banana.Filters = new CIFilter[] { filter };
        }
Example #16
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            SCNTransaction.Begin();
            SCNTransaction.AnimationDuration = 1;

            switch (index)
            {
            case 0:
                break;

            case 1:
                //add a plan in the background
                TextManager.FadeOutText(SlideTextManager.TextType.Code);
                TextManager.FadeOutText(SlideTextManager.TextType.Subtitle);

                var bg    = SCNNode.Create();
                var plane = SCNPlane.Create(100, 100);
                bg.Geometry = plane;
                bg.Position = new SCNVector3(0, 0, -60);
                presentationViewController.CameraNode.AddChildNode(bg);

                ((SCNView)presentationViewController.View).Scene.FogColor         = NSColor.White;
                ((SCNView)presentationViewController.View).Scene.FogStartDistance = 10;
                ((SCNView)presentationViewController.View).Scene.FogEndDistance   = 50;
                break;

            case 2:
                ((SCNView)presentationViewController.View).Scene.FogDensityExponent = 0.3f;
                break;
            }

            SCNTransaction.Commit();
        }
Example #17
0
 public override void WillOrderOut(PresentationViewController presentationViewController)
 {
     SCNTransaction.Begin();
     SCNTransaction.AnimationDuration = 0.75f;
     ChapterNode.Position             = new SCNVector3(ChapterNode.Position.X - 30, ChapterNode.Position.Y, ChapterNode.Position.Z);
     SCNTransaction.Commit();
 }
Example #18
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Fog");
            TextManager.SetSubtitle("SCNScene");

            TextManager.AddEmptyLine();
            TextManager.AddCode("// set some fog\n\naScene.#fogColor# = aColor;\n\naScene.#fogStartDistance# = 50;\n\naScene.#fogEndDistance# = 100;#");

            //add palm trees
            var palmTree = Utils.SCAddChildNode(GroundNode, "PalmTree", "Scenes.scnassets/palmTree/palm_tree", 15);

            palmTree.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI / 2));
            palmTree.Position = new SCNVector3(4, -1, 0);

            palmTree = palmTree.Clone();
            GroundNode.AddChildNode(palmTree);
            palmTree.Position = new SCNVector3(0, -1, 7);

            palmTree = palmTree.Clone();
            GroundNode.AddChildNode(palmTree);
            palmTree.Position = new SCNVector3(8, -1, 13);

            palmTree = palmTree.Clone();
            GroundNode.AddChildNode(palmTree);
            palmTree.Position = new SCNVector3(13, -1, -7);

            palmTree = palmTree.Clone();
            GroundNode.AddChildNode(palmTree);
            palmTree.Position = new SCNVector3(-13, -1, -14);

            palmTree = palmTree.Clone();
            GroundNode.AddChildNode(palmTree);
            palmTree.Position = new SCNVector3(3, -1, -14);
        }
Example #19
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 ("Techniques", new CGPoint (10, -8), 0);
			PlaceFeature ("SpriteKit materials", new CGPoint (-16, -7), 0.05f);
			PlaceFeature ("Inverse Kinematics", new CGPoint (-12, -6), 0.1f);
			PlaceFeature ("Actions", new CGPoint (-10, 6), 0.15f);
			PlaceFeature ("SKTexture", new CGPoint (4, 9), 0.2f);
			PlaceFeature ("JavaScript", new CGPoint (-4, 8), 0.25f);
			PlaceFeature ("Alembic", new CGPoint (-3, -8), 0.3f);
			PlaceFeature ("OpenSubdiv", new CGPoint (-1, 6), 0.35f);
			PlaceFeature ("Assets catalog", new CGPoint (1, 5), 0.85f);
			PlaceFeature ("SIMD bridge", new CGPoint (3, -6), 0.45f);
			PlaceFeature ("Physics", new CGPoint (-0.5f, 0), 0.47f);
			PlaceFeature ("Vehicle", new CGPoint (5, 3), 0.50f);
			PlaceFeature ("Fog", new CGPoint (7, 2), 0.95f);
			PlaceFeature ("SpriteKit Overlays", new CGPoint (-10, 1), 0.60f);
			PlaceFeature ("Particles", new CGPoint (-13, -1), 0.65f);
			PlaceFeature ("Forward shadows", new CGPoint (8, -1), 0.7f);
			PlaceFeature ("Snapshot", new CGPoint (6, -2), 0.75f);
			PlaceFeature ("Physics Fields", new CGPoint (-6, -3), 0.8f);
			PlaceFeature ("Archiving", new CGPoint (-11, 3), 0.9f);
			PlaceFeature ("Performance tools", new CGPoint (-2, -5), 1);
		}
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Scene Kit");
            TextManager.SetSubtitle("Introduction");
            TextManager.AddBulletAtLevel("High level API for 3D integration", 0);
            TextManager.AddBulletAtLevel("Data visualization", 1);
            TextManager.AddBulletAtLevel("User Interface", 1);
            TextManager.AddBulletAtLevel("Casual Games", 1);

            var redColor    = NSColor.FromDeviceRgba(168.0f / 255.0f, 21.0f / 255.0f, 1.0f / 255.0f, 1);
            var grayColor   = NSColor.Gray;
            var greenColor  = NSColor.FromDeviceRgba(105.0f / 255.0f, 145.0f / 255.0f, 14.0f / 255.0f, 1);
            var orangeColor = NSColor.Orange;
            var purpleColor = NSColor.FromDeviceRgba(152.0f / 255.0f, 57.0f / 255.0f, 189.0f / 255.0f, 1);

            Boxes = new List <SCNNode> ();

            AddBox("Cocoa", new CGRect(0, 0, 500, 70), 3, grayColor);
            AddBox("Core Image", new CGRect(0, 0, 100, 70), 2, greenColor);
            AddBox("Core Animation", new CGRect(390, 0, 110, 70), 2, greenColor);
            AddBox("Sprite Kit", new CGRect(250, 0, 135, 70), 2, greenColor);
            AddBox("Scene Kit", new CGRect(105, 0, 140, 70), 2, orangeColor);
            AddBox("OpenGL / OpenGL ES", new CGRect(0, 0, 500, 70), 1, purpleColor);
            AddBox("Graphics Hardware", new CGRect(0, 0, 500, 70), 0, redColor);
        }
Example #21
0
        private void PresentPrimitives(PresentationViewController presentationViewController)
        {
            var count  = 100;
            var spread = 0.0f;

            // create a cube with a sphere shape
            for (int i = 0; i < count; ++i)
            {
                var model = SCNNode.Create();
                model.Position    = GroundNode.ConvertPositionToNode(new SCNVector3(RandFloat(-1, 1), RandFloat(30, 50), RandFloat(-1, 1)), null);
                model.EulerAngles = new SCNVector3(RandFloat(0, NMath.PI * 2), RandFloat(0, NMath.PI * 2), RandFloat(0, NMath.PI * 2));

                var size          = new SCNVector3(RandFloat(1.0, 1.5), RandFloat(1.0, 1.5), RandFloat(1.0, 1.5));
                var random        = new Random((int)DateTime.Now.Ticks);
                int geometryIndex = random.Next(0, 7);
                switch (geometryIndex)
                {
                case 0:                 // Box
                    model.Geometry = SCNBox.Create(size.X, size.Y, size.Z, 0);
                    break;

                case 1:                 // Pyramid
                    model.Geometry = SCNPyramid.Create(size.X, size.Y, size.Z);
                    break;

                case 2:                 // Sphere
                    model.Geometry = SCNSphere.Create(size.X);
                    break;

                case 3:                 // Cylinder
                    model.Geometry = SCNCylinder.Create(size.X, size.Y);
                    break;

                case 4:                 // Tube
                    model.Geometry = SCNTube.Create(size.X, size.X + size.Z, size.Y);
                    break;

                case 5:                 // Capsule
                    model.Geometry = SCNCapsule.Create(size.X, size.Y + 2 * size.X);
                    break;

                case 6:                 // Torus
                    model.Geometry = SCNTorus.Create(size.X, NMath.Min(size.X, size.Y) / 2);
                    break;

                default:
                    break;
                }

                model.Geometry.FirstMaterial.Multiply.Contents = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/texture", "png"));

                model.PhysicsBody                 = SCNPhysicsBody.CreateDynamicBody();
                model.PhysicsBody.Velocity        = new SCNVector3(RandFloat(-spread, spread), -10, RandFloat(-spread, spread));
                model.PhysicsBody.AngularVelocity = new SCNVector4(RandFloat(-1, 1), RandFloat(-1, 1), RandFloat(-1, 1), RandFloat(-3, 3));

                Shapes.Add(model);

                ((SCNView)presentationViewController.View).Scene.RootNode.AddChildNode(model);
            }
        }
		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.Red;
			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);
		}
Example #23
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.scnassets/intersection/intersection", 10);
			signNode.Position = new SCNVector3 (4, 0, 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);
			}

			foreach (var cameraNode in cameraNodes) {
				var previousWorldTransform = cameraNode.WorldTransform;
				intermediateNode.AddChildNode (cameraNode); // re-parent
				cameraNode.Transform = intermediateNode.ConvertTransformFromNode (previousWorldTransform, null);
				cameraNode.Scale = new SCNVector3 (1, 1, 1);
			}

			// Set the slide's title and subtitle and add some text
			TextManager.SetTitle ("Node Attributes");
			TextManager.SetSubtitle ("SCNCamera");
			TextManager.AddBulletAtLevel ("Point of view for renderers", 0);

			TextManager.AddCode ("#aNode.#Camera# = #SCNCamera#.Create (); \naView.#PointOfView# = aNode;#");
		}
Example #24
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Particles");
			TextManager.SetSubtitle ("SCNParticleSystem");
			TextManager.AddBulletAtLevel ("Achieve a large number of effects", 0);
			TextManager.AddBulletAtLevel ("3D particle editor built into Xcode", 0);
		}
Example #25
0
 public override void WillOrderOut(PresentationViewController presentationViewController)
 {
     SCNTransaction.Begin();
     // Switch the light off
     LightNode.Light = null;
     SCNTransaction.Commit();
 }
Example #26
0
		public override void WillOrderOut (PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 0.75f;
			ChapterNode.Position = new SCNVector3 (ChapterNode.Position.X-30, ChapterNode.Position.Y, ChapterNode.Position.Z);
			SCNTransaction.Commit ();
		}
Example #27
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);
        }
        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.Red;
            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);
        }
Example #29
0
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 1;

			switch(index){
			case 0:
				break;
			case 1:
				//add a plan in the background
				TextManager.FadeOutText (SlideTextManager.TextType.Code);
				TextManager.FadeOutText (SlideTextManager.TextType.Subtitle);

				var bg = SCNNode.Create ();
				var plane = SCNPlane.Create (100, 100);
				bg.Geometry = plane;
				bg.Position = new SCNVector3 (0, 0, -60);
				presentationViewController.CameraNode.AddChildNode (bg);

				((SCNView)presentationViewController.View).Scene.FogColor = NSColor.White;
				((SCNView)presentationViewController.View).Scene.FogStartDistance = 10;
				((SCNView)presentationViewController.View).Scene.FogEndDistance = 50;
				break;
			case 2:
				((SCNView)presentationViewController.View).Scene.FogDensityExponent = 0.3f;
				break;
			}

			SCNTransaction.Commit ();
		}
Example #30
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);
		}
Example #31
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Fog");
			TextManager.SetSubtitle ("SCNScene");

			TextManager.AddEmptyLine ();
			TextManager.AddCode ("// set some fog\n\naScene.#fogColor# = aColor;\n\naScene.#fogStartDistance# = 50;\n\naScene.#fogEndDistance# = 100;#");

			//add palm trees
			var palmTree = Utils.SCAddChildNode (GroundNode, "PalmTree", "Scenes.scnassets/palmTree/palm_tree", 15);
			palmTree.Rotation = new SCNVector4 (1, 0, 0, -(float)(Math.PI / 2));
			palmTree.Position = new SCNVector3 (4, -1, 0);

			palmTree = palmTree.Clone ();
			GroundNode.AddChildNode (palmTree);
			palmTree.Position = new SCNVector3 (0, -1, 7);

			palmTree = palmTree.Clone ();
			GroundNode.AddChildNode (palmTree);
			palmTree.Position = new SCNVector3 (8, -1, 13);

			palmTree = palmTree.Clone ();
			GroundNode.AddChildNode (palmTree);
			palmTree.Position = new SCNVector3 (13, -1, -7);

			palmTree = palmTree.Clone ();
			GroundNode.AddChildNode (palmTree);
			palmTree.Position = new SCNVector3 (-13, -1, -14);

			palmTree = palmTree.Clone ();
			GroundNode.AddChildNode (palmTree);
			palmTree.Position = new SCNVector3 (3, -1, -14);
		}
Example #32
0
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			switch (index) {
			case 0:
				break;
			case 1:
				TextManager.FlipOutText (SlideTextManager.TextType.Code);
				TextManager.FlipOutText (SlideTextManager.TextType.Bullet);
				TextManager.AddEmptyLine ();
				TextManager.AddBulletAtLevel ("Javascript code example", 0);
				TextManager.AddCode ("#\n#//allocate a node#\n"
				+ "var aNode = SCNNode.Create ();\n\n"
				+ "#//change opacity#\n"
				+ "aNode.Opacity = 0.5f;\n\n"
				+ "#//remove from parent#\n"
				+ "aNode.RemoveFromParentNode ();\n\n"
				+ "#//animate implicitly#\n"
				+ "SCNTransaction.Begin ();\n"
				+ "SCNTransaction.AnimationDuration = 1.0f;\n"
				+ "aNode.Scale = new SCNVector3 (2, 2, 2);\n"
				+ "SCNTransaction.Commit ();#");

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

				break;
			case 2:
				TextManager.FlipOutText (SlideTextManager.TextType.Bullet);
				TextManager.FlipOutText (SlideTextManager.TextType.Code);
				TextManager.AddBulletAtLevel ("Tools", 0);
				TextManager.AddBulletAtLevel ("Debugging", 0);
				TextManager.FlipInText (SlideTextManager.TextType.Bullet);
				break;
			}
		}
Example #33
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Add some text
            TextManager.SetTitle("Loading a 3D Scene");
            TextManager.SetSubtitle("DAE Documents");

            NodesToDim = new List <SCNNode> ();

            TextManager.AddBulletAtLevel("Geometries", 0);
            TextManager.AddBulletAtLevel("Animations", 0);
            NodesToDim.Add(TextManager.AddBulletAtLevel("Textures", 0));
            NodesToDim.Add(TextManager.AddBulletAtLevel("Lighting", 0));
            NodesToDim.Add(TextManager.AddBulletAtLevel("Cameras", 0));
            NodesToDim.Add(TextManager.AddBulletAtLevel("Skinning", 0));
            NodesToDim.Add(TextManager.AddBulletAtLevel("Morphing", 0));

            // And an image resting on the ground
            DaeIcon          = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/dae file icon", "png"), 10, false);
            DaeIcon.Position = new SCNVector3(6, 4.5f, 1);
            GroundNode.AddChildNode(DaeIcon);

            AbcIcon          = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/abc file icon", "png"), 10, false);
            AbcIcon.Position = new SCNVector3(6, 4.5f, 30);
            GroundNode.AddChildNode(AbcIcon);
        }
Example #34
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 ();
		}
Example #35
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Constraints");
			TextManager.SetSubtitle ("SCNIKConstraint");

			TextManager.AddBulletAtLevel ("Inverse Kinematics", 0);
			TextManager.AddBulletAtLevel ("Node chain", 0);
			TextManager.AddBulletAtLevel ("Target", 0);

			//load the hero
			Hero = Utils.SCAddChildNode (GroundNode, "heroGroup", "Scenes.scnassets/hero/hero", 12);
			Hero.Position = new SCNVector3 (0, 0, 5);
			Hero.Rotation = new SCNVector4 (1, 0, 0, -NMath.PI / 2);

			//hide the sword
			var sword = Hero.FindChildNode ("sword", true);
			sword.Hidden = true;

			//load attack animation
			var path = NSBundle.MainBundle.PathForResource ("Scenes.scnassets/hero/attack", "dae");
			var source = SCNSceneSource.FromUrl (NSUrl.FromFilename (path), (NSDictionary)null);
			Attack = (CAAnimation)source.GetEntryWithIdentifier ("attackID", new Class ("CAAnimation"));
			Attack.RepeatCount = 0;
			Attack.FadeInDuration = 0.1f;
			Attack.FadeOutDuration = 0.3f;
			Attack.Speed = 0.75f;

			Attack.AnimationEvents = new SCNAnimationEvent[] { SCNAnimationEvent.Create (0.55f, (CAAnimation animation, NSObject animatedObject, bool playingBackward) => {
					if (IkActive)
						DestroyTarget ();
				})
			};

			AnimationDuration = Attack.Duration;

			//setup IK
			var hand = Hero.FindChildNode ("Bip01_R_Hand", true);
			var clavicle = Hero.FindChildNode ("Bip01_R_Clavicle", true);
			var head = Hero.FindChildNode ("Bip01_Head", true);

			Ik = SCNIKConstraint.Create (clavicle);
			hand.Constraints = new SCNConstraint[] { Ik };
			Ik.InfluenceFactor = 0.0f;

			//add target
			Target = SCNNode.Create ();
			Target.Position = new SCNVector3 (-4, 7, 10);
			Target.Opacity = 0;
			Target.Geometry = SCNPlane.Create (2, 2);
			Target.Geometry.FirstMaterial.Diffuse.Contents = new NSImage (NSBundle.MainBundle.PathForResource ("Images/target", "png"));
			GroundNode.AddChildNode (Target);

			//look at
			LookAt = SCNLookAtConstraint.Create (Target);
			LookAt.InfluenceFactor = 0;
			head.Constraints = new SCNConstraint[] { LookAt };

			((SCNView)presentationViewController.View).WeakSceneRendererDelegate = this;
		}
Example #36
0
 public override void SetupSlide(PresentationViewController presentationViewController)
 {
     TextManager.SetTitle("Summary");
     TextManager.AddBulletAtLevel("SceneKit available on iOS", 0);
     TextManager.AddBulletAtLevel("Casual game ready", 0);
     TextManager.AddBulletAtLevel("Full featured rendering", 0);
     TextManager.AddBulletAtLevel("Extendable", 0);
 }
Example #37
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Scene Kit Editor");
			TextManager.AddBulletAtLevel ("Built into Xcode", 0);
			TextManager.AddBulletAtLevel ("Scene graph inspection", 0);
			TextManager.AddBulletAtLevel ("Rendering preview", 0);
			TextManager.AddBulletAtLevel ("Adjust lightning and materials", 0);
		}
Example #38
0
		public override void DidOrderIn (PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 1.0f;
			SlideSceneGraph.ScenegraphDiagramGoToStep (5);
			SceneGraphDiagramNode.Opacity = 1.0f;
			SCNTransaction.Commit ();
		}
Example #39
0
 public override void SetupSlide(PresentationViewController presentationViewController)
 {
     TextManager.SetTitle("Scene Kit Editor");
     TextManager.AddBulletAtLevel("Built into Xcode", 0);
     TextManager.AddBulletAtLevel("Scene graph inspection", 0);
     TextManager.AddBulletAtLevel("Rendering preview", 0);
     TextManager.AddBulletAtLevel("Adjust lightning and materials", 0);
 }
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("3D Particle Editor");

            TextManager.AddBulletAtLevel("Integrated into Xcode", 0);
            TextManager.AddBulletAtLevel("Edit .scnp files", 0);
            TextManager.AddBulletAtLevel("Particle templates available", 0);
        }
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("3D Particle Editor");

			TextManager.AddBulletAtLevel ("Integrated into Xcode", 0);
			TextManager.AddBulletAtLevel ("Edit .scnp files", 0);
			TextManager.AddBulletAtLevel ("Particle templates available", 0);
		}
Example #42
0
 public override void WillOrderOut(PresentationViewController presentationViewController)
 {
     SCNTransaction.Begin();
     SCNTransaction.AnimationDuration = 1;
     presentationViewController.CameraNode.Constraints = new SCNConstraint[0];
     presentationViewController.SpotLight.Constraints  = new SCNConstraint[0];
     SCNTransaction.Commit();
 }
Example #43
0
 public override void DidOrderIn(PresentationViewController presentationViewController)
 {
     SCNTransaction.Begin();
     SCNTransaction.AnimationDuration = 1.0f;
     SlideSceneGraph.ScenegraphDiagramGoToStep(5);
     SceneGraphDiagramNode.Opacity = 1.0f;
     SCNTransaction.Commit();
 }
Example #44
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Summary");
			TextManager.AddBulletAtLevel ("SceneKit available on iOS", 0);
			TextManager.AddBulletAtLevel ("Casual game ready", 0);
			TextManager.AddBulletAtLevel ("Full featured rendering", 0);
			TextManager.AddBulletAtLevel ("Extendable", 0);
		}
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            switch (index)
            {
            case 0:
                TextManager.SetTitle("Animation Events");
                TextManager.AddBulletAtLevel("SCNAnimationEvent", 0);
                TextManager.AddBulletAtLevel("Smooth transitions", 0);

                TextManager.AddCode("#var anEvent = #SCNAnimationEvent.Create# (0.2,  aBlock); \n"
                                    + "anAnimation.#AnimationEvents# = @[anEvent, anotherEvent];#");

                var path      = NSBundle.MainBundle.PathForResource("Sounds/bossaggro", "wav");
                var soundUrl  = NSUrl.FromFilename(path);
                var bossaggro = new NSSound(soundUrl, false);
                bossaggro.Play();
                break;

            case 1:
                // Trigger the attack animation
                HeroSkeletonNode.AddAnimation(Animations [(int)CharacterAnimation.Attack], new NSString("attack"));
                break;

            case 2:
                TextManager.FadeOutText(SlideTextManager.TextType.Code);
                TextManager.AddCode("#\n"
                                    + "\n"
                                    + "\n\n"
                                    + "anAnimation.FadeInDuration = #0.0#;\n"
                                    + "anAnimation.FadeOutDuration = #0.0#;#");
                break;

            case 3:
            case 4:
                Animations[(int)CharacterAnimation.Attack].FadeInDuration  = 0;
                Animations[(int)CharacterAnimation.Attack].FadeOutDuration = 0;
                // Trigger the attack animation
                HeroSkeletonNode.AddAnimation(Animations [(int)CharacterAnimation.Attack], new NSString("attack"));
                break;

            case 5:
                TextManager.FadeOutText(SlideTextManager.TextType.Code);
                TextManager.AddCode("#\n"
                                    + "\n"
                                    + "\n\n"
                                    + "anAnimation.FadeInDuration = #0.3#;\n"
                                    + "anAnimation.FadeOutDuration = #0.3#;#");
                break;

            case 6:
            case 7:
                Animations[(int)CharacterAnimation.Attack].FadeInDuration  = 0.3f;
                Animations[(int)CharacterAnimation.Attack].FadeOutDuration = 0.3f;
                // Trigger the attack animation
                HeroSkeletonNode.AddAnimation(Animations [(int)CharacterAnimation.Attack], new NSString("attack"));
                break;
            }
        }
Example #46
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Displaying the 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("Scene Manipulation");
            TextManager.SetSubtitle("Animations");

            TextManager.AddBulletAtLevel("Properties are animatable", 0);
            TextManager.AddBulletAtLevel("Implicit and explicit animations", 0);
            TextManager.AddBulletAtLevel("Same programming model as Core Animation", 0);
        }
Example #48
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Actions");
            TextManager.SetSubtitle("SCNAction");

            TextManager.AddBulletAtLevel("Easy to sequence, group and repeat", 0);
            TextManager.AddBulletAtLevel("Limited to SCNNode", 0);
            TextManager.AddBulletAtLevel("Same programming model as SpriteKit", 0);
        }
Example #49
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Per-Frame Updates");
			TextManager.SetSubtitle ("Game Loop");

			var gameLoop = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/gameLoop", "png"), 17, false);
			gameLoop.Position = new SCNVector3 (0, 6, 10);
			GroundNode.AddChildNode (gameLoop);
		}
Example #50
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Actions");
			TextManager.SetSubtitle ("SCNAction");

			TextManager.AddBulletAtLevel ("Easy to sequence, group and repeat", 0);
			TextManager.AddBulletAtLevel ("Limited to SCNNode", 0);
			TextManager.AddBulletAtLevel ("Same programming model as SpriteKit", 0);
		}
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Displaying the 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 ("Scene Manipulation");
			TextManager.SetSubtitle ("Animations");

			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 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();
        }
Example #54
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Outline");

			TextManager.AddBulletAtLevel ("Scene graph overview", 0);
			TextManager.AddBulletAtLevel ("Getting started", 0);
			TextManager.AddBulletAtLevel ("Animating", 0);
			TextManager.AddBulletAtLevel ("Rendering", 0);
			TextManager.AddBulletAtLevel ("Effects", 0);
		}
Example #55
0
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			// Set the slide's title
			TextManager.SetTitle ("Labs");

			var relatedImage = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/labs", "png"), 35, false);
			relatedImage.Position = new SCNVector3 (0, 30, 0);
			relatedImage.CastsShadow = false;
			ContentNode.AddChildNode (relatedImage);
		}
Example #56
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Related Sessions");

			// load the "related.png" image and show it mapped on a plane
			var relatedImage = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/related", "png"), 35, false);
			relatedImage.Position = new SCNVector3 (0, 10, 0);
			relatedImage.CastsShadow = false;
			GroundNode.AddChildNode (relatedImage);
		}
Example #57
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			TextManager.SetTitle ("Multi-Pass Effects");
			TextManager.SetSubtitle ("SCNTechnique");

			TextManager.AddBulletAtLevel ("Multi-pass effects", 0);
			TextManager.AddBulletAtLevel ("Post processing", 0);
			TextManager.AddBulletAtLevel ("Chain passes", 0);
			TextManager.AddBulletAtLevel ("Set and animate shader uniforms from C#", 0);
		}
Example #58
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Multi-Pass Effects");
            TextManager.SetSubtitle("SCNTechnique");

            TextManager.AddBulletAtLevel("Multi-pass effects", 0);
            TextManager.AddBulletAtLevel("Post processing", 0);
            TextManager.AddBulletAtLevel("Chain passes", 0);
            TextManager.AddBulletAtLevel("Set and animate shader uniforms from C#", 0);
        }
Example #59
0
		public override void WillOrderOut (PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 0.5f;
			((SCNView)presentationViewController.View).Scene.FogColor = NSColor.Black;
			((SCNView)presentationViewController.View).Scene.FogEndDistance = 45.0f;
			((SCNView)presentationViewController.View).Scene.FogDensityExponent = 1.0f;
			((SCNView)presentationViewController.View).Scene.FogStartDistance = 40.0f;
			SCNTransaction.Commit ();
		}
Example #60
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Per-Frame Updates");
            TextManager.SetSubtitle("Game Loop");

            var gameLoop = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/gameLoop", "png"), 17, false);

            gameLoop.Position = new SCNVector3(0, 6, 10);
            GroundNode.AddChildNode(gameLoop);
        }