public static SCPlaneNode ( string path, float size, bool isLit ) : SCNNode | ||
path | string | |
size | float | |
isLit | bool | |
return | SCNNode |
void ShowCodeExample(string code, string imageName, string extension) { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0; TextManager.FadeOutText(SlideTextManager.TextType.Code); if (code != null) { var codeNode = TextManager.AddCode(code); SCNVector3 min, max; min = new SCNVector3(0, 0, 0); max = new SCNVector3(0, 0, 0); codeNode.GetBoundingBox(ref min, ref max); if (imageName != null) { SCNNode imageNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Scenes/earth/" + imageName, extension), 4.0f, false); imageNode.Position = new SCNVector3(max.X + 2.5f, min.Y + 0.2f, 0); codeNode.AddChildNode(imageNode); max.X += 4.0f; } codeNode.Position = new SCNVector3(6 - (min.X + max.X) / 2, 10 - min.Y, 0); } SCNTransaction.Commit(); }
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) { 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(); }
public override void SetupSlide(PresentationViewController presentationViewController) { // Add some text TextManager.SetTitle("Renderers"); TextManager.SetSubtitle("View creation in Interface Builder"); TextManager.AddBulletAtLevel("Drag an SCNView from the library", 0); // And an image var imageNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/renderers/Interface Builder", "png"), 8.3f, false); imageNode.Position = new SCNVector3(0.0f, 3.2f, 11.0f); ContentNode.AddChildNode(imageNode); }
public override void SetupSlide(PresentationViewController presentationViewController) { TextManager.SetTitle("Renderers"); // Add labels var node = Utils.SCLabelNode("SCNView", Utils.LabelSize.Normal, true); node.Position = new SCNVector3(-14, 7, 0); ContentNode.AddChildNode(node); node = Utils.SCLabelNode("SCNLayer", Utils.LabelSize.Normal, true); node.Position = new SCNVector3(-2.2f, 7, 0); ContentNode.AddChildNode(node); node = Utils.SCLabelNode("SCNRenderer", Utils.LabelSize.Normal, true); node.Position = new SCNVector3(9.5f, 7, 0); ContentNode.AddChildNode(node); // Add images - SCNView var box = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/renderers/renderer-window", "png"), 8, true); box.Position = new SCNVector3(-10, 3, 5); ContentNode.AddChildNode(box); box = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/renderers/teapot", "tiff"), 6, true); box.Position = new SCNVector3(-10, 3, 5.1f); ContentNode.AddChildNode(box); // Add images - SCNLayer box = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/renderers/renderer-layer", "png"), 7.4f, true); box.Position = new SCNVector3(0, 3.5f, 5); box.Rotation = new SCNVector4(0, 0, 1, (float)(Math.PI / 20)); ContentNode.AddChildNode(box); box = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/renderers/teapot", "tiff"), 6, true); box.Position = new SCNVector3(0, 3.5f, 5.1f); box.Rotation = new SCNVector4(0, 0, 1, (float)(Math.PI / 20)); ContentNode.AddChildNode(box); // Add images - SCNRenderer box = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/renderers/renderer-framebuffer", "png"), 8, true); box.Position = new SCNVector3(10, 3.2f, 5); ContentNode.AddChildNode(box); box = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/renderers/teapot", "tiff"), 6, true); box.Position = new SCNVector3(10, 3, 5.1f); ContentNode.AddChildNode(box); }
public override void DidOrderIn(PresentationViewController presentationViewController) { // Bring up a screenshot of the editor var editorScreenshotNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/editor", "png"), 14, true); editorScreenshotNode.Position = new SCNVector3(17, 4.1f, 5); editorScreenshotNode.Rotation = new SCNVector4(0, 1, 0, -(float)(Math.PI / 1.5f)); GroundNode.AddChildNode(editorScreenshotNode); // Animate it (rotate and move) SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; editorScreenshotNode.Position = new SCNVector3(7.5f, 4.1f, 5); editorScreenshotNode.Rotation = new SCNVector4(0, 1, 0, -(float)(Math.PI / 6.0f)); SCNTransaction.Commit(); }
public override void SetupSlide(PresentationViewController presentationViewController) { // Add some text TextManager.SetTitle("Working with DAE Files"); TextManager.SetSubtitle("DAE Files on OS X"); // DAE icon var daeIconNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/dae file icon", "png"), 5, false); daeIconNode.Position = new SCNVector3(0, 2.3f, 0); GroundNode.AddChildNode(daeIconNode); // Preview icon and text var previewIconNode = Utils.SCPlaneNodeWithImage(Utils.SCImageFromApplication("Preview"), 3, false); previewIconNode.Position = new SCNVector3(-5, 1.3f, 11); GroundNode.AddChildNode(previewIconNode); var previewTextNode = Utils.SCLabelNode("Preview", Utils.LabelSize.Small, false); previewTextNode.Position = new SCNVector3(-5.5f, 0, 13); GroundNode.AddChildNode(previewTextNode); // Quicklook icon and text var qlIconNode = Utils.SCPlaneNodeWithImage(Utils.SCImageFromApplication("Finder"), 3, false); qlIconNode.Position = new SCNVector3(0, 1.3f, 11); GroundNode.AddChildNode(qlIconNode); var qlTextNode = Utils.SCLabelNode("QuickLook", Utils.LabelSize.Small, false); qlTextNode.Position = new SCNVector3(-1.11f, 0, 13); GroundNode.AddChildNode(qlTextNode); // Xcode icon and text var xcodeIconNode = Utils.SCPlaneNodeWithImage(Utils.SCImageFromApplication("Xcode"), 3, false); xcodeIconNode.Position = new SCNVector3(5, 1.3f, 11); GroundNode.AddChildNode(xcodeIconNode); var xcodeTextNode = Utils.SCLabelNode("Xcode", Utils.LabelSize.Small, false); xcodeTextNode.Position = new SCNVector3(3.8f, 0, 13); GroundNode.AddChildNode(xcodeTextNode); }
public override void SetupSlide(PresentationViewController presentationViewController) { // Add some text TextManager.SetTitle("Loading a 3D Scene"); TextManager.SetSubtitle("DAE Documents"); TextManager.AddBulletAtLevel("Geometries", 0); TextManager.AddBulletAtLevel("Animations", 0); TextManager.AddBulletAtLevel("Textures", 0); TextManager.AddBulletAtLevel("Lighting", 0); TextManager.AddBulletAtLevel("Cameras", 0); TextManager.AddBulletAtLevel("Skinning", 0); TextManager.AddBulletAtLevel("Morphing", 0); // And an image resting on the ground var imageNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/dae file icon", "png"), 10, false); imageNode.Position = new SCNVector3(6, 4.5f, 1); GroundNode.AddChildNode(imageNode); }
public override void PresentStep(int index, PresentationViewController presentationViewController) { switch (index) { case 0: // Set the slide's title and subtile and add some code TextManager.SetTitle("Performance"); TextManager.SetSubtitle("Statistics"); TextManager.AddCode("#// Show statistics \n" + "aSCNView.#ShowsStatistics# = true;"); break; case 1: // Place a screenshot in the scene and animate it WindowNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/statistics/statistics", "png"), 20, true); ContentNode.AddChildNode(WindowNode); WindowNode.Opacity = 0.0f; WindowNode.Position = new SCNVector3(20, 5.2f, 9); WindowNode.Rotation = new SCNVector4(0, 1, 0, -(float)(Math.PI / 4)); SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; WindowNode.Opacity = 1.0f; WindowNode.Position = new SCNVector3(0, 5.2f, 7); WindowNode.Rotation = new SCNVector4(0, 1, 0, 0); SCNTransaction.Commit(); // The screenshot contains transparent areas so we need to make sure it is rendered // after the text (which also sets its rendering order) WindowNode.RenderingOrder = 2; break; case 2: FpsNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/statistics/statistics-fps", "png"), 7, false); WindowNode.AddChildNode(FpsNode); FpsNode.Scale = new SCNVector3(0.75f, 0.75f, 0.75f); FpsNode.Opacity = 0.0f; FpsNode.Position = new SCNVector3(-6, -3, 0.5f); FpsNode.RenderingOrder = 4; SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0.5f; FpsNode.Scale = new SCNVector3(1.0f, 1.0f, 1.0f); FpsNode.Opacity = 1.0f; SCNTransaction.Commit(); break; case 3: ButtonNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/statistics/statistics-button", "png"), 4, false); WindowNode.AddChildNode(ButtonNode); ButtonNode.Scale = new SCNVector3(0.75f, 0.75f, 0.75f); ButtonNode.Opacity = 0.0f; ButtonNode.Position = new SCNVector3(-7.5f, -2.75f, 0.5f); ButtonNode.RenderingOrder = 5; SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0.5f; FpsNode.Opacity = 0.0f; ButtonNode.Scale = new SCNVector3(1.0f, 1.0f, 1.0f); ButtonNode.Opacity = 1.0f; SCNTransaction.Commit(); break; case 4: PanelNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/statistics/control-panel", "png"), 10, false); WindowNode.AddChildNode(PanelNode); PanelNode.Scale = new SCNVector3(0.75f, 0.75f, 0.75f); PanelNode.Opacity = 0.0f; PanelNode.Position = new SCNVector3(3.5f, -0.5f, 1.5f); PanelNode.RenderingOrder = 6; SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0.5f; PanelNode.Scale = new SCNVector3(1.0f, 1.0f, 1.0f); PanelNode.Opacity = 1.0f; SCNTransaction.Commit(); break; case 5: var detailsNode = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/statistics/statistics-detail", "png"), 9, false); WindowNode.AddChildNode(detailsNode); detailsNode.Scale = new SCNVector3(0.75f, 0.75f, 0.75f); detailsNode.Opacity = 0.0f; detailsNode.Position = new SCNVector3(5, -2.75f, 1.5f); detailsNode.RenderingOrder = 7; SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0.5f; PanelNode.Opacity = 0.0f; ButtonNode.Opacity = 0.0f; detailsNode.Scale = new SCNVector3(1.0f, 1.0f, 1.0f); detailsNode.Opacity = 1.0f; SCNTransaction.Commit(); break; } }