當前位置: 首頁>>代碼示例>>C#>>正文


C# SceneKitSessionWWDC2013.PresentationViewController類代碼示例

本文整理匯總了C#中SceneKitSessionWWDC2013.PresentationViewController的典型用法代碼示例。如果您正苦於以下問題:C# PresentationViewController類的具體用法?C# PresentationViewController怎麽用?C# PresentationViewController使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PresentationViewController類屬於SceneKitSessionWWDC2013命名空間,在下文中一共展示了PresentationViewController類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PresentStep

		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 ();
			});
		}
開發者ID:hitchingsh,項目名稱:mac-samples,代碼行數:33,代碼來源:SlideLabs.cs

示例2: SetupSlide

		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);
		}
開發者ID:hitchingsh,項目名稱:mac-samples,代碼行數:7,代碼來源:SlideCreateAScene.cs

示例3: SetupSlide

		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
			};
		}
開發者ID:RangoLee,項目名稱:mac-samples,代碼行數:26,代碼來源:SlideMorphing.cs

示例4: WillOrderOut

		public override void WillOrderOut (PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			// Switch the light off
			LightNode.Light = null;
			SCNTransaction.Commit ();
		}
開發者ID:hitchingsh,項目名稱:mac-samples,代碼行數:7,代碼來源:SlideLight.cs

示例5: PresentStep

		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;
			}
		}
開發者ID:hitchingsh,項目名稱:mac-samples,代碼行數:33,代碼來源:SlideFlattening.cs

示例6: PresentStep

		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;
			}
		}
開發者ID:hitchingsh,項目名稱:mac-samples,代碼行數:26,代碼來源:SlideOutline.cs

示例7: PresentStep

		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 ();
		}
開發者ID:RangoLee,項目名稱:mac-samples,代碼行數:33,代碼來源:SlideImplicitAnimations.cs

示例8: SetupSlide

		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);
			}
		}
開發者ID:hitchingsh,項目名稱:mac-samples,代碼行數:28,代碼來源:SlideCamera.cs

示例9: SetupSlide

		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);
		}
開發者ID:hitchingsh,項目名稱:mac-samples,代碼行數:33,代碼來源:SlideAllNew.cs

示例10: PresentStep

		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 ();
		}
開發者ID:hitchingsh,項目名稱:mac-samples,代碼行數:33,代碼來源:SlideMaterialConfigure.cs

示例11: SetupSlide

		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);
		}
開發者ID:RangoLee,項目名稱:mac-samples,代碼行數:32,代碼來源:SlideImplicitAnimations.cs

示例12: SetupSlide

		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");
		}
開發者ID:RangoLee,項目名稱:mac-samples,代碼行數:34,代碼來源:SlideAnimationEvents.cs

示例13: DidOrderIn

		public override void DidOrderIn (PresentationViewController presentationViewController)
		{
			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 1.0f;
			sceneGraphDiagramNode.Opacity = 1.0f;
			SCNTransaction.Commit ();
		}
開發者ID:RangoLee,項目名稱:mac-samples,代碼行數:7,代碼來源:SlideManipulation2.cs

示例14: SetupSlide

		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);
		}
開發者ID:hitchingsh,項目名稱:mac-samples,代碼行數:31,代碼來源:SlideExplicitAnimations.cs

示例15: SetupSlide

		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);
		}
開發者ID:RangoLee,項目名稱:mac-samples,代碼行數:8,代碼來源:SlideShaderModifiers.cs


注:本文中的SceneKitSessionWWDC2013.PresentationViewController類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。