/Rendering/CameraTests/LookAtCameraTests.cs
C# | 89 lines | 44 code | 10 blank | 35 comment | 0 complexity | 126bca2571dc84fb409b62712b635b7e MD5 | raw file
Possible License(s): Apache-2.0
- using Delta.ContentSystem.Rendering;
- using Delta.Engine;
- using Delta.Rendering.Basics.Drawing;
- using Delta.Rendering.Cameras;
- using Delta.Rendering.Models;
- using Delta.Utilities;
- using Delta.Utilities.Datatypes;
- using NUnit.Framework;
-
- namespace Delta.Rendering.CameraTests
- {
- /// <summary>
- /// All unit tests for look at cameras.
- /// </summary>
- [Category("Visual")]
- public class LookAtCameraTests
- {
- #region TestLookAtCamera (Static)
- /// <summary>
- /// Test look center camera
- /// </summary>
- [Test]
- public static void TestLookAtCamera()
- {
- LookAtCamera testCamera = new LookAtCamera(new Vector(10, 5, 4));
- Assert.NotNull(testCamera);
- Assert.Equal(new Vector(10, 5, 4), testCamera.Position);
- }
- #endregion
-
- #region DefaultCameraBehavior (Static)
- /// <summary>
- /// Default Camera Behavior
- /// </summary>
- [Test]
- public static void DefaultCameraBehavior()
- {
- // At second we need to initialize the camera which we wanna use in the
- // scene
- LookAtCamera centerCam = new LookAtCamera(new Vector(0, -5, 5));
-
- // First create a mesh to see something
- MaterialData materialData = new MaterialData
- {
- ShaderName = "TexturedShader3D",
- DiffuseMapName = "AngelHighDiffuseAlphaTest",
- };
-
- const float planeSize = 2;
-
- Mesh groundPlane = Mesh.CreatePlane("PlaneXY", planeSize, planeSize,
- materialData);
- //Model xPlane = new Model("PlaneXZ", planeSize, planeSize,
- // materialData);
- // xPlane.Rotation = new Vector(0, 90, 0);
- //Model yPlane = new Model("PlaneYZ", planeSize, planeSize,
- // materialData);
- //yPlane.Rotation = new Vector(0, 0, 90);
-
- //Label camPositionLabel = new Label
- //{
- // //IsAutoSizing = false,
- // LocalArea = new Rectangle(0.05f, 0.13f, 0.35f, 0.05f),
- //};
-
- //Label camRotationLabel = new Label
- //{
- // //IsAutoSizing = false,
- // LocalArea = new Rectangle(0.05f, 0.18f, 0.35f, 0.05f),
- //};
-
- // Draw the created mesh
- Application.Start(delegate
- {
- //centerCam.Update();
- //camPositionLabel.Text = "Position=" + centerCam.Position;
- //camRotationLabel.Text = "Rotation=" + centerCam.Rotation;
-
- //testMesh.Draw(Matrix.Identity);
- groundPlane.Draw();
- Grid.Draw();
-
- //xPlane.Draw();
- //yPlane.Draw();
- });
- }
- #endregion
- }
- }