PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 37ms app.codeStats 0ms

/Rendering/CameraTests/Program.cs

#
C# | 95 lines | 54 code | 8 blank | 33 comment | 1 complexity | 940ac1cfbb9fff5cb56fa7c9ab49ae70 MD5 | raw file
 1using Delta.Engine;
 2using Delta.Rendering.Cameras;
 3using Delta.Utilities;
 4using Delta.Utilities.Datatypes;
 5
 6namespace Delta.Rendering.CameraTests
 7{
 8	/// <summary>
 9	/// Program
10	/// </summary>
11	internal class Program
12	{
13		#region Main (Static)
14		/// <summary>
15		/// Main entry point.
16		/// </summary>
17		public static void Main()
18		{
19			#region Tests
20			//LookAtCameraTests.TestLookAtCamera();
21			//LookAtCameraTests.DefaultCameraBehavior();
22
23			//IsometricCameraTests.TestIsometricCamera();
24			//IsometricCameraTests.TestIsoPerspectiveCamera();
25
26			//GameCameraTests.TestGameCamera();
27			//GameCameraTests.DefaultCameraBehavior();
28
29			//FreeCameraTests.TestFreeCamera();
30			//FreeCameraTests.DefaultCameraBehavior();
31			//FreeCameraTests.TestRotation();
32			//FreeCameraTests.TestMoving();
33			//FreeCameraTests.TestMovingRotating();
34
35			//PathCameraTests.Start();
36			#endregion
37
38			#region Tutorials
39			Tutorials.UseLookAtCamera();
40			//Tutorials.UseFreeCamera();
41			//Tutorials.UseGameCamera();
42			//Tutorials.UseIsometricCamera();
43			//Tutorials.UsePathCamera();
44			#endregion
45		}
46		#endregion
47
48		#region MixedCameraActivation (Static)
49		/// <summary>
50		/// This test simply checks if the activation logic works, so only
51		/// one camera updates itself and not every camera at all.
52		/// Because a camera is now a dynamic module it's updating itself
53		/// every tick, regardless if it should or not, so we store which camera
54		/// is currently active in BaseCamera.Current and only this one is
55		/// allowed to update itself.
56		/// An exception to this rule are multi-component cameras, which enable
57		/// AlwaysNeedsUpdate. This type of camera implements its own logic if it
58		/// should actually do something or not.
59		/// </summary>
60		public static void MixedCameraActivation()
61		{
62			LookAtCamera cam1 = new LookAtCamera(Vector.One);
63			FreeCamera cam2 = new FreeCamera(Vector.One * 2f);
64			int iteration = 0;
65			Application.Start(delegate
66			{
67				Log.Info("iteration=" + iteration);
68				switch (iteration)
69				{
70					case 0:
71						cam2.Activate();
72						break;
73					case 1:
74						cam1.Activate();
75						break;
76					case 2:
77						cam2.Activate();
78						break;
79					case 3:
80						cam1.Activate();
81						break;
82					case 4:
83						cam2.Activate();
84						break;
85					case 5:
86						Application.Quit();
87						break;
88				}
89
90				iteration++;
91			});
92		}
93		#endregion
94	}
95}