PageRenderTime 100ms CodeModel.GetById 92ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Rendering/CameraTests/Tutorials.cs

#
C# | 122 lines | 77 code | 10 blank | 35 comment | 0 complexity | 6f962566cd0b49ee0d191e117c682281 MD5 | raw file
  1using Delta.Engine;
  2using Delta.Rendering.Basics.Drawing;
  3using Delta.Rendering.Cameras;
  4using Delta.Utilities.Datatypes;
  5
  6namespace Delta.Rendering.CameraTests
  7{
  8	public class Tutorials
  9	{
 10		#region UseLookAtCamera (Static)
 11		/// <summary>
 12		/// Tutorial: Camera Tutorial 1: Look-At Camera
 13		/// Difficulty: Easy
 14		/// Description: Use a simple "Look At" camera.
 15		/// Image: http://DeltaEngine.net/Icons/CameraTutorial1.png
 16		/// </summary>
 17		public static void UseLookAtCamera()
 18		{
 19			// Create the camera. It will be activated automatically.
 20			LookAtCamera camera = new LookAtCamera(new Vector(20f, 25f, 40f));
 21
 22			Application.Start(delegate
 23			{
 24				Grid.Draw();
 25			});
 26		}
 27		#endregion
 28
 29		#region UseIsometricCamera (Static)
 30		/// <summary>
 31		/// Tutorial: Camera Tutorial 2: Isometric Camera
 32		/// Difficulty: Easy
 33		/// Description: Use a simple Isometric camera.
 34		/// Image: http://DeltaEngine.net/Icons/CameraTutorial2.png
 35		/// </summary>
 36		public static void UseIsometricCamera()
 37		{
 38			// Create the camera. It will be activated automatically.
 39			IsometricCamera camera = new IsometricCamera(new Vector(0f, 0f, 5f));
 40			camera.Distance = 15f;
 41			camera.Target = Vector.Zero;
 42
 43			Application.Start(delegate
 44			{
 45				Grid.Draw();
 46			});
 47		}
 48		#endregion
 49
 50		#region UseFreeCamera (Static)
 51		/// <summary>
 52		/// Tutorial: Camera Tutorial 3: Free Camera
 53		/// Difficulty: Easy
 54		/// Description: Use a simple free camera.
 55		/// Image: http://DeltaEngine.net/Icons/CameraTutorial3.png
 56		/// </summary>
 57		public static void UseFreeCamera()
 58		{
 59			// Create the camera. It will be activated automatically.
 60			FreeCamera camera = new FreeCamera(new Vector(0f, 0f, 5f));
 61
 62			Application.Start(delegate
 63			{
 64				Grid.Draw();
 65			});
 66		}
 67		#endregion
 68
 69		#region UseGameCamera (Static)
 70		/// <summary>
 71		/// Tutorial: Camera Tutorial 4: Game Camera
 72		/// Difficulty: Easy
 73		/// Description: Use a simple game camera.
 74		/// Image: http://DeltaEngine.net/Icons/CameraTutorial4.png
 75		/// </summary>
 76		public static void UseGameCamera()
 77		{
 78			// Create the camera. It will be activated automatically.
 79			GameCamera camera = new GameCamera(new[]
 80			{
 81				Matrix.CreateTranslation(20, 20, 20),
 82				Matrix.CreateTranslation(-20, 20, 20),
 83				Matrix.CreateTranslation(-20, -20, 20),
 84				Matrix.CreateTranslation(20, -20, 20),
 85			});
 86
 87			Application.Start(delegate
 88			{
 89				Grid.Draw();
 90			});
 91		}
 92		#endregion
 93
 94		#region UsePathCamera (Static)
 95		/// <summary>
 96		/// Tutorial: Camera Tutorial 5: Path Camera
 97		/// Difficulty: Easy
 98		/// Description: Use a simple path camera.
 99		/// Image: http://DeltaEngine.net/Icons/CameraTutorial5.png
100		/// </summary>
101		public static void UsePathCamera()
102		{
103			// Create the camera. It will be activated automatically.
104			PathCamera camera = new PathCamera(new[]
105			{
106				new Vector(20, 20, 20),
107				new Vector(-20, 20, 20),
108				new Vector(-20, -20, 20),
109				new Vector(20, -20, 20),
110			}, new[]
111			{
112				Vector.Zero,
113			});
114
115			Application.Start(delegate
116			{
117				Grid.Draw();
118			});
119		}
120		#endregion
121	}
122}