public override void WillOrderOut(PresentationViewController presentationViewController) { NSNotificationCenter.DefaultCenter.RemoveObserver(this, AVPlayerItem.DidPlayToEndTimeNotification, PlayerLayer1.Player.CurrentItem); NSNotificationCenter.DefaultCenter.RemoveObserver(this, AVPlayerItem.DidPlayToEndTimeNotification, PlayerLayer2.Player.CurrentItem); PlayerLayer1.Player.Pause(); PlayerLayer2.Player.Pause(); // Stop playing scene animations, restore the original point of view and restore the default spot light mode ((SCNView)presentationViewController.View).Playing = false; ((SCNView)presentationViewController.View).PointOfView = presentationViewController.CameraNode; presentationViewController.NarrowSpotlight(false); }
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("Materials"); TextManager.SetSubtitle("CALayer as texture"); TextManager.AddCode("#// Map a layer tree on a 3D object. \n" + "aNode.Geometry.FirstMaterial.Diffuse.#Contents# = #aLayerTree#;#"); // Add the model var intermediateNode = SCNNode.Create(); intermediateNode.Position = new SCNVector3(0, 3.9f, 8); intermediateNode.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI / 2)); GroundNode.AddChildNode(intermediateNode); Utils.SCAddChildNode(intermediateNode, "frames", "Scenes/frames/frames", 8); presentationViewController.NarrowSpotlight(true); break; case 1: SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; // Change the point of view to "frameCamera" (a camera defined in the "frames" scene) var frameCamera = ContentNode.FindChildNode("frameCamera", true); ((SCNView)presentationViewController.View).PointOfView = frameCamera; // The "frames" scene contains animations, update the end time of our main scene and start to play the animations ((SCNView)presentationViewController.View).Scene.SetAttribute(new NSNumber(7.33f), SCNScene.EndTimeAttributeKey); ((SCNView)presentationViewController.View).CurrentTime = 0; ((SCNView)presentationViewController.View).Playing = true; ((SCNView)presentationViewController.View).Loops = true; PlayerLayer1 = ConfigurePlayer(NSBundle.MainBundle.PathForResource("Movies/movie1", "mov"), "PhotoFrame-Vertical"); PlayerLayer2 = ConfigurePlayer(NSBundle.MainBundle.PathForResource("Movies/movie2", "mov"), "PhotoFrame-Horizontal"); 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 ("Materials"); TextManager.SetSubtitle ("CALayer as texture"); TextManager.AddCode ("#// Map a layer tree on a 3D object. \n" + "aNode.Geometry.FirstMaterial.Diffuse.#Contents# = #aLayerTree#;#"); // Add the model var intermediateNode = SCNNode.Create (); intermediateNode.Position = new SCNVector3 (0, 3.9f, 8); intermediateNode.Rotation = new SCNVector4 (1, 0, 0, -(float)(Math.PI / 2)); GroundNode.AddChildNode (intermediateNode); Utils.SCAddChildNode (intermediateNode, "frames", "Scenes/frames/frames", 8); presentationViewController.NarrowSpotlight (true); break; case 1: SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 1; // Change the point of view to "frameCamera" (a camera defined in the "frames" scene) var frameCamera = ContentNode.FindChildNode ("frameCamera", true); ((SCNView)presentationViewController.View).PointOfView = frameCamera; // The "frames" scene contains animations, update the end time of our main scene and start to play the animations ((SCNView)presentationViewController.View).Scene.SetAttribute (new NSNumber (7.33f), SCNScene.EndTimeAttributeKey); ((SCNView)presentationViewController.View).CurrentTime = 0; ((SCNView)presentationViewController.View).Playing = true; ((SCNView)presentationViewController.View).Loops = true; PlayerLayer1 = ConfigurePlayer (NSBundle.MainBundle.PathForResource ("Movies/movie1", "mov"), "PhotoFrame-Vertical"); PlayerLayer2 = ConfigurePlayer (NSBundle.MainBundle.PathForResource ("Movies/movie2", "mov"), "PhotoFrame-Horizontal"); SCNTransaction.Commit (); break; } }
public override void WillOrderOut (PresentationViewController presentationViewController) { NSNotificationCenter.DefaultCenter.RemoveObserver (this, AVPlayerItem.DidPlayToEndTimeNotification, PlayerLayer1.Player.CurrentItem); NSNotificationCenter.DefaultCenter.RemoveObserver (this, AVPlayerItem.DidPlayToEndTimeNotification, PlayerLayer2.Player.CurrentItem); PlayerLayer1.Player.Pause (); PlayerLayer2.Player.Pause (); //playerLayer1.Player = null; //playerLayer2.Player = null; // Stop playing scene animations, restore the original point of view and restore the default spot light mode ((SCNView)presentationViewController.View).Playing = false; ((SCNView)presentationViewController.View).PointOfView = presentationViewController.CameraNode; presentationViewController.NarrowSpotlight (false); }