public void Constructor() { var stand = new Mock<IStand>().Object; var lense = new Mock<ILense>().Object; var cam = new Camera(stand, lense); Assert.IsNotNull(cam); Assert.AreSame(stand, cam.Stand); Assert.AreSame(lense, cam.Lense); }
public void ViewProjectionMatrix() { var stand = new Mock<IStand>(); var lense = new Mock<ILense>(); var viewMatrix = new Matrix(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44); stand.SetupGet(x => x.ViewMatrix).Returns(viewMatrix); var projectionMatrix = new Matrix(0, 1, 2, 3, 10, 11, 12, 13, 20, 21, 22, 23, 30, 31, 32, 33); lense.SetupGet(x => x.ProjectionMatrix).Returns(projectionMatrix); var cam = new Camera(stand.Object, lense.Object); Assert.AreEqual(viewMatrix * projectionMatrix, cam.ViewProjectionMatrix); }
/// <summary> /// Loads the resources for this scene. /// </summary> public override void Load() { var container = new GraphicStreamContainer(); var positions = container.Create(GraphicStreamUsage.Position, CreatePositions()); var colors = container.Create(GraphicStreamUsage.Color, CreateColors()); IBufferService bufferService = new XnaBufferService(RenderWindow.Device); var bufferBindings = new[] { bufferService.CreateFor(colors), bufferService.CreateFor(positions), }; mEffect = new XnaEffectCompiler(RenderWindow.Device).Compile("MyShader.fx"); mRenderer = new XnaObjectRenderer(RenderWindow.Device, mEffect, bufferBindings); mWorldViewProjectionParameter = new XnaMatrixEffectParameter("WorldViewProjection"); mCamera = new Camera(new Stand(), new PerspectiveProjectionLense()); mCamera.Stand.Position = new Vector3(0, 0, 3); SetupKeysAndActions(); }