示例#1
0
 public override void DidOrderIn(PresentationViewController presentationViewController)
 {
     SCNTransaction.Begin();
     SCNTransaction.AnimationDuration = 1.0f;
     SlideSceneGraph.ScenegraphDiagramGoToStep(5);
     SceneGraphDiagramNode.Opacity = 1.0f;
     SCNTransaction.Commit();
 }
示例#2
0
        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);
        }
示例#3
0
        public override void DidOrderIn(PresentationViewController presentationViewController)
        {
            var diagramNode = SlideSceneGraph.SharedScenegraphDiagramNode();

            SCNTransaction.Begin();

            SCNTransaction.AnimationDuration = 1.0f;
            diagramNode.Opacity  = 1.0f;
            diagramNode.Rotation = new SCNVector4(1, 0, 0, 0);
            SlideSceneGraph.ShowNodesNamed(new string[] { "scene" });

            SCNTransaction.Commit();
        }
示例#4
0
        private static void ShowNodesNamed(string[] names)
        {
            var diagramNode = SlideSceneGraph.SharedScenegraphDiagramNode();

            SCNTransaction.Begin();
            SCNTransaction.AnimationDuration = 1.0f;
            foreach (var nodeName in names)
            {
                var node = diagramNode.FindChildNode(nodeName, true);
                node.Opacity = 1.0f;
                if (node.Rotation.Z == 0.0f)
                {
                    node.Rotation = new SCNVector4(0, 1, 0, 0);
                }
            }
            SCNTransaction.Commit();
        }
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Scene Manipulation");
            TextManager.SetSubtitle("Retrieving a node");

            TextManager.AddCode("#// Get by name \n"
                                + "var aNode = scene.RootNode \n"
                                + "            .#FindChildNode #(\"aName\", true);#");

            sceneGraphDiagramNode = SlideSceneGraph.SharedScenegraphDiagramNode();
            SlideSceneGraph.ScenegraphDiagramGoToStep(7);

            sceneGraphDiagramNode.Opacity  = 0.0f;
            sceneGraphDiagramNode.Position = new SCNVector3(1.5f, 8.0f, 0);

            ContentNode.AddChildNode(sceneGraphDiagramNode);
        }
示例#6
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            TextManager.SetTitle("Materials");

            TextManager.AddBulletAtLevel("Determines the appearance of the geometry", 0);
            TextManager.AddBulletAtLevel("SCNMaterial", 0);
            TextManager.AddBulletAtLevel("Material properties", 0);
            TextManager.AddBulletAtLevel("SCNMaterialProperty", 1);
            TextManager.AddBulletAtLevel("Contents is a color or an image", 1);

            // Prepare the diagram but hide it for now
            SceneGraphDiagramNode = SlideSceneGraph.SharedScenegraphDiagramNode();
            SlideSceneGraph.ScenegraphDiagramGoToStep(0);

            SceneGraphDiagramNode.Position = new SCNVector3(3.0f, 8.0f, 0);
            SceneGraphDiagramNode.Opacity  = 0.0f;

            ContentNode.AddChildNode(SceneGraphDiagramNode);
        }
示例#7
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            var diagramNode = SlideSceneGraph.SharedScenegraphDiagramNode();

            SlideSceneGraph.ScenegraphDiagramGoToStep(index);

            switch (index)
            {
            case 0:
                diagramNode.Opacity  = 0.0f;
                diagramNode.Position = new SCNVector3(0.0f, 5.0f, 0.0f);
                diagramNode.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI / 2));
                break;

            case 1:
                SCNTransaction.Begin();

                SCNTransaction.AnimationDuration = 0;
                TextManager.FlipOutText(SlideTextManager.TextType.Bullet);
                TextManager.FlipOutText(SlideTextManager.TextType.Subtitle);

                // Change the slide's subtitle and add some text
                TextManager.SetSubtitle("Node");
                TextManager.AddBulletAtLevel("SCNNode", 0);
                TextManager.AddBulletAtLevel("A location in 3D space", 0);
                TextManager.AddBulletAtLevel("Position / Rotation / Scale", 1);

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

                SCNTransaction.Commit();
                break;

            case 2:
                TextManager.AddBulletAtLevel("Hierarchy of nodes", 0);
                TextManager.AddBulletAtLevel("Relative to the parent node", 1);
                break;

            case 3:
                SCNTransaction.Begin();

                SCNTransaction.AnimationDuration = 0;
                TextManager.FlipOutText(SlideTextManager.TextType.Bullet);
                TextManager.FlipOutText(SlideTextManager.TextType.Subtitle);

                // Change the slide's subtitle and add some text
                TextManager.SetSubtitle("Node attributes");
                TextManager.AddBulletAtLevel("Geometry", 0);
                TextManager.AddBulletAtLevel("Camera", 0);
                TextManager.AddBulletAtLevel("Light", 0);
                TextManager.AddBulletAtLevel("Can be shared", 0);

                TextManager.FlipInText(SlideTextManager.TextType.Subtitle);
                TextManager.FlipInText(SlideTextManager.TextType.Bullet);
                SCNTransaction.Commit();

                SCNTransaction.Begin();

                SCNTransaction.AnimationDuration = 1.0f;
                // move the diagram up otherwise it would intersect the floor
                diagramNode.Position = new SCNVector3(0.0f, diagramNode.Position.Y + 1.0f, 0.0f);

                SCNTransaction.Commit();
                break;
            }
        }
示例#8
0
        public static void ScenegraphDiagramGoToStep(int step)
        {
            var diagramNode = SlideSceneGraph.SharedScenegraphDiagramNode();

            switch (step)
            {
            case 0:
                // Restore the initial state (hidden and rotated)
                foreach (var child in diagramNode)
                {
                    child.Opacity = 0.0f;
                    if (child.Rotation.Z == 0)                     // don't touch nodes that already have a rotation set
                    {
                        child.Rotation = new SCNVector4(0, 1, 0, (float)(Math.PI / 2));
                    }
                }
                break;

            case 1:
                ShowNodesNamed(new string[] { "sceneArrow", "rootNode" });
                break;

            case 2:
                ShowNodesNamed(new string[] { "child1", "child2", "child3", "nodeArrow1", "nodeArrow2", "nodeArrow3" });
                break;

            case 3:
                ShowNodesNamed(new string[] {
                    "light",
                    "camera",
                    "geometry",
                    "lightArrow",
                    "cameraArrow",
                    "geometryArrow",
                    "geometryArrow2"
                });
                break;

            case 4:
                ShowNodesNamed(new string[] {
                    "scene",
                    "sceneArrow",
                    "rootNode",
                    "light",
                    "camera",
                    "cameraArrow",
                    "child1",
                    "child2",
                    "child3",
                    "nodeArrow1",
                    "nodeArrow2",
                    "nodeArrow3",
                    "geometry",
                    "lightArrow",
                    "geometryArrow",
                    "geometryArrow2"
                });
                HighlightNodes(new string[] {
                    "scene",
                    "sceneArrow",
                    "rootNode",
                    "light",
                    "camera",
                    "cameraArrow",
                    "child1",
                    "child2",
                    "child3",
                    "nodeArrow1",
                    "nodeArrow2",
                    "nodeArrow3",
                    "geometry",
                    "lightArrow",
                    "geometryArrow",
                    "geometryArrow2"
                }, diagramNode);
                break;

            case 5:
                ShowNodesNamed(new string[] {
                    "scene",
                    "sceneArrow",
                    "rootNode",
                    "light",
                    "camera",
                    "cameraArrow",
                    "child1",
                    "child2",
                    "child3",
                    "nodeArrow1",
                    "nodeArrow2",
                    "nodeArrow3",
                    "geometry",
                    "lightArrow",
                    "geometryArrow",
                    "geometryArrow2",
                    "materials"
                });
                HighlightNodes(new string[] {
                    "scene",
                    "sceneArrow",
                    "rootNode",
                    "child2",
                    "child3",
                    "nodeArrow2",
                    "nodeArrow3",
                    "geometry",
                    "geometryArrow",
                    "geometryArrow2",
                    "materials"
                }, diagramNode);
                break;

            case 6:
                HighlightNodes(new string[] { "child3", "geometryArrow", "geometry" }, diagramNode);
                break;

            case 7:
                ShowNodesNamed(new string[] {
                    "scene",
                    "sceneArrow",
                    "rootNode",
                    "light",
                    "camera",
                    "cameraArrow",
                    "child1",
                    "child2",
                    "child3",
                    "nodeArrow1",
                    "nodeArrow2",
                    "nodeArrow3",
                    "geometry",
                    "lightArrow",
                    "geometryArrow",
                    "geometryArrow2",
                    "materials"
                });
                break;
            }
        }