本文整理汇总了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 ();
});
}
示例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);
}
示例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
};
}
示例4: WillOrderOut
public override void WillOrderOut (PresentationViewController presentationViewController)
{
SCNTransaction.Begin ();
// Switch the light off
LightNode.Light = null;
SCNTransaction.Commit ();
}
示例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;
}
}
示例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;
}
}
示例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 ();
}
示例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);
}
}
示例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);
}
示例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 ();
}
示例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);
}
示例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");
}
示例13: DidOrderIn
public override void DidOrderIn (PresentationViewController presentationViewController)
{
SCNTransaction.Begin ();
SCNTransaction.AnimationDuration = 1.0f;
sceneGraphDiagramNode.Opacity = 1.0f;
SCNTransaction.Commit ();
}
示例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);
}
示例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);
}