Provides the ability to create, open and save ZCA files used for camera information.
Inheritance: FileLoader
Exemple #1
0
        public void TestSaveMethod()
        {
            CameraFile cameraFile = new CameraFile();
            cameraFile.Load(TEST_FILE);

            MemoryStream savedStream = new MemoryStream();
            cameraFile.Save(savedStream);

            savedStream.Seek(0, SeekOrigin.Begin);

            CameraFile savedCameraFile = new CameraFile();
            savedCameraFile.Load(savedStream);

            savedStream.Close();

            Assert.AreEqual(cameraFile.ProjectionType, savedCameraFile.ProjectionType, "Projection types do not match");
            Assert.AreEqual(cameraFile.ModelView, savedCameraFile.ModelView, "Model view matrices do not match");
            Assert.AreEqual(cameraFile.Projection, savedCameraFile.Projection, "Projection matrices do not match");
            Assert.AreEqual(cameraFile.FieldOfView, savedCameraFile.FieldOfView, "Field of view values do not match");
            Assert.AreEqual(cameraFile.AspectRatio, savedCameraFile.AspectRatio, "Aspect ratio values do not match");
            Assert.AreEqual(cameraFile.NearPlane, savedCameraFile.NearPlane, "Near plane values do not match");
            Assert.AreEqual(cameraFile.FarPlane, savedCameraFile.FarPlane, "Far plane values do not match");
            Assert.AreEqual(cameraFile.Eye, savedCameraFile.Eye, "Eye positions do not match");
            Assert.AreEqual(cameraFile.Center, savedCameraFile.Center, "Center position do not match");
            Assert.AreEqual(cameraFile.Up, savedCameraFile.Up, "Up positions do not match");
        }
Exemple #2
0
        public void TestLoadMethod()
        {
            Stream stream = File.OpenRead(TEST_FILE);

            stream.Seek(0, SeekOrigin.End);
            long fileSize = stream.Position;
            stream.Seek(0, SeekOrigin.Begin);

            CameraFile cameraFile = new CameraFile();
            cameraFile.Load(stream);

            long streamPosition = stream.Position;
            stream.Close();

            Assert.AreEqual(fileSize, streamPosition, "Not all of the file was read");
        }