Esempio n. 1
0
        public void Camera_PlaneDistance_Test()
        {
            var camera = new Camera();
            Assert.AreEqual(1.0f, camera.NearPlaneDistance);
            Assert.AreEqual(100000.0f, camera.FarPlaneDistance);

            var expectedNear = 200.0f;
            var expectedFar = 50000.0f;
            camera.SetPlaneDistance(expectedNear, expectedFar);
            Assert.AreEqual(expectedNear, camera.NearPlaneDistance);
            Assert.AreEqual(expectedFar, camera.FarPlaneDistance);
        }
Esempio n. 2
0
        public void Camera_ProjectionMatrix_Test()
        {
            var camera = new Camera();
            var projMat = camera.ProjectionMatrix;

            // FovY changes
            var oldFovY = camera.FovY;
            camera.FovY = oldFovY / 2;
            Assert.AreNotEqual(projMat, camera.ProjectionMatrix);
            camera.FovY = oldFovY;  // restore
            Assert.AreEqual(projMat, camera.ProjectionMatrix);

            // Aspect ratio changes
            var oldAspect = camera.AspectRatio;
            camera.AspectRatio = oldAspect / 2;
            Assert.AreNotEqual(projMat, camera.ProjectionMatrix);
            camera.AspectRatio = oldAspect;
            Assert.AreEqual(projMat, camera.ProjectionMatrix);

            // Plane distance changes
            var oldNear = camera.NearPlaneDistance;
            var oldFar = camera.FarPlaneDistance;
            camera.SetPlaneDistance(oldNear / 2, oldFar / 2);
            Assert.AreNotEqual(projMat, camera.ProjectionMatrix);
            camera.SetPlaneDistance(oldNear, oldFar);
            Assert.AreEqual(projMat, camera.ProjectionMatrix);
        }
Esempio n. 3
0
 public void Camera_PlaneDistance_FarShouldBeLargerThanNear_Test()
 {
     var camera = new Camera();
     camera.SetPlaneDistance(100.0f, 100.0f);
 }