FreeCameraTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Rendering3D.Tests.Cameras FreeCameraTests

Namespace: DeltaEngine.Rendering3D.Tests.Cameras
Assembly: DeltaEngine.Rendering3D.Tests (in DeltaEngine.Rendering3D.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class FreeCameraTests : TestWithMocksOrVisually

The FreeCameraTests type exposes the following members.

Constructors

  NameDescription
Public methodFreeCameraTests
Initializes a new instance of the FreeCameraTests class
Top
Methods

  NameDescription
Public methodAdjustPitch
Public methodAdjustRoll
Public methodAdjustYaw
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodMove
Public methodMoveBackward
Public methodMoveDown
Public methodMoveForward
Public methodMoveFreeCamera
Public methodMoveLeft
Public methodMoveRight
Public methodMoveUp
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Public methodRotateThenMove
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUpCamera
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void MoveFreeCamera()
{
    new Grid3D(new Size(100));
    RegisterCommand(Key.J, () => camera.MoveLeft(MoveDistance));
    RegisterCommand(Key.L, () => camera.MoveRight(MoveDistance));
    RegisterCommand(Key.I, () => camera.MoveUp(MoveDistance));
    RegisterCommand(Key.K, () => camera.MoveDown(MoveDistance));
    RegisterCommand(Key.U, () => camera.MoveForward(MoveDistance));
    RegisterCommand(Key.O, () => camera.MoveBackward(MoveDistance));
    RegisterCommand(Key.A, () => camera.AdjustYaw(RotationAngle));
    RegisterCommand(Key.D, () => camera.AdjustYaw(-RotationAngle));
    RegisterCommand(Key.W, () => camera.AdjustPitch(RotationAngle));
    RegisterCommand(Key.S, () => camera.AdjustPitch(-RotationAngle));
    RegisterCommand(Key.Q, () => camera.AdjustRoll(-RotationAngle));
    RegisterCommand(Key.E, () => camera.AdjustRoll(RotationAngle));
}
[Test, CloseAfterFirstFrame]
public void Move()
{
    camera.Move(Vector3D.UnitX, 1.0f);
    Assert.AreEqual(new Vector3D(1.0f, 5.0f, 5.0f), camera.Position);
}
[Test, CloseAfterFirstFrame]
public void AdjustPitch()
{
    camera.AdjustPitch(45.0f);
    Assert.AreEqual(new EulerAngles(45.0f, 0.0f, 0.0f), camera.Rotation.ToEuler());
}
[Test, CloseAfterFirstFrame]
public void AdjustYaw()
{
    camera.AdjustYaw(-45.0f);
    Assert.AreEqual(new EulerAngles(0.0f, -45.0f, 0.0f), camera.Rotation.ToEuler());
}
[Test, CloseAfterFirstFrame]
public void AdjustRoll()
{
    camera.AdjustRoll(90.0f);
    Assert.AreEqual(new EulerAngles(0.0f, 0.0f, 90.0f), camera.Rotation.ToEuler());
}
[Test, CloseAfterFirstFrame]
public void RotateThenMove()
{
    camera.Rotate(Vector3D.UnitZ, 90.0f);
    camera.Move(Vector3D.UnitX, 1.0f);
    Assert.IsTrue(camera.Position.IsNearlyEqual(new Vector3D(0.0f, 6.0f, 5.0f)));
}
[Test, CloseAfterFirstFrame]
public void MoveUp()
{
    camera.MoveUp(10.0f);
    Assert.AreEqual(new Vector3D(0.0f, 15.0f, 5.0f), camera.Position);
}
[Test, CloseAfterFirstFrame]
public void MoveDown()
{
    camera.MoveDown(10.0f);
    Assert.AreEqual(new Vector3D(0.0f, -5.0f, 5.0f), camera.Position);
}
[Test, CloseAfterFirstFrame]
public void MoveLeft()
{
    camera.MoveLeft(10.0f);
    Assert.AreEqual(new Vector3D(-10.0f, 5.0f, 5.0f), camera.Position);
}
[Test, CloseAfterFirstFrame]
public void MoveRight()
{
    camera.MoveRight(10.0f);
    Assert.AreEqual(new Vector3D(10.0f, 5.0f, 5.0f), camera.Position);
}
[Test, CloseAfterFirstFrame]
public void MoveForward()
{
    camera.MoveForward(10.0f);
    Assert.AreEqual(new Vector3D(0.0f, 5.0f, -5.0f), camera.Position);
}
[Test, CloseAfterFirstFrame]
public void MoveBackward()
{
    camera.MoveBackward(10.0f);
    Assert.AreEqual(new Vector3D(0.0f, 5.0f, 15.0f), camera.Position);
}
See Also