PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/Rendering/CameraTests/Tutorials.cs

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