Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Rendering3D.Tests.Cameras LookAtCameraTests
Namespace: DeltaEngine.Rendering3D.Tests.Cameras
Assembly: DeltaEngine.Rendering3D.Tests (in DeltaEngine.Rendering3D.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The LookAtCameraTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
LookAtCameraTests | Initializes a new instance of the LookAtCameraTests class |
Methods
Name | Description | |
---|---|---|
ActivateShakeEffect | ||
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
CenterOfScreenWithLookAtCameraPointsToTarget | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
LookAtEntity3D | ||
OverZoomTowardTheTarget | ||
PositionToTargetDistance | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
RenderGrid | ||
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RotateCamera90DegreesAroundZAxis | ||
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
WorldToScreenPoint | ||
ZoomOutwardTheTarget | ||
ZoomTowardTheTarget |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test, ApproveFirstFrameScreenshot] public void RenderGrid() { CreateLookAtCamera(new Vector3D(0.0f, -5.0f, 5.0f), Vector3D.Zero); new Grid3D(new Size(9)); }
[Test, CloseAfterFirstFrame] public void PositionToTargetDistance() { var camera = CreateLookAtCamera(Vector3D.UnitZ * 5.0f, Vector3D.Zero); Assert.AreEqual(5.0f, camera.Position.Length - camera.Target.Length); }
[Test, CloseAfterFirstFrame] public void RotateCamera90DegreesAroundZAxis() { var camera = CreateLookAtCamera(Vector3D.UnitY, Vector3D.Zero); Assert.AreEqual(Vector3D.Zero, camera.YawPitchRoll); camera.YawPitchRoll = new Vector3D(90.0f, 0.0f, 0.0f); Assert.IsTrue(camera.Position.IsNearlyEqual(-Vector3D.UnitX)); Assert.AreEqual(Vector3D.Zero, camera.Target); }
[Test, CloseAfterFirstFrame] public void LookAtEntity3D() { var entity = new Entity3D(Vector3D.One * 5.0f, Quaternion.Identity); var camera = CreateLookAtCamera(Vector3D.Zero, entity); Assert.AreEqual(camera.Target, entity.Position); }
[Test, CloseAfterFirstFrame] public void ZoomTowardTheTarget() { var camera = CreateLookAtCamera(Vector3D.UnitX * 2.0f, Vector3D.Zero); camera.Zoom(1.0f); Assert.AreEqual(Vector3D.UnitX, camera.Position); }
[Test, CloseAfterFirstFrame] public void ZoomOutwardTheTarget() { var camera = CreateLookAtCamera(Vector3D.UnitX, Vector3D.Zero); camera.Zoom(-1.0f); Assert.AreEqual(Vector3D.UnitX * 2.0f, camera.Position); }
[Test, CloseAfterFirstFrame] public void OverZoomTowardTheTarget() { var camera = CreateLookAtCamera(Vector3D.UnitX * 3.0f, Vector3D.Zero); camera.Zoom(100.0f); Assert.IsTrue(camera.Position.IsNearlyEqual(Vector3D.Zero)); }
[Test, CloseAfterFirstFrame] public void WorldToScreenPoint() { var camera = CreateLookAtCamera(Vector3D.One, Vector3D.Zero); var point = camera.WorldToScreenPoint(Vector3D.Zero); Assert.AreEqual(Vector2D.Half, point); }
[Test, CloseAfterFirstFrame] public void CenterOfScreenWithLookAtCameraPointsToTarget() { VerifyScreenCenterIsTarget(new Vector3D(3.0f, 3.0f, 3.0f), new Vector3D(1.0f, 1.0f, 2.0f)); VerifyScreenCenterIsTarget(new Vector3D(1.0f, 4.0f, 1.5f), new Vector3D(-2.9f, 0.0f, 2.5f)); VerifyScreenCenterIsTarget(new Vector3D(-1.0f, -4.0f, 2.5f), new Vector3D(2.9f, -1.0f, 3.5f)); }
[Test] public void ActivateShakeEffect() { var camera = CreateLookAtCamera(new Vector3D(0.0f, -5.0f, 5.0f), Vector3D.Zero); new Grid3D(new Size(10)); camera.Start<CameraShakingUpdater>(); new Command(() => { CameraShakingUpdater.isShaking = true; }).Add(new KeyTrigger(Key.Space)); }
See Also