Revise.Files.ZCA.CameraFile.Load C# (CSharp) Method

Load() public method

Loads the file from the specified stream.
public Load ( Stream stream ) : void
stream System.IO.Stream The stream to read from.
return void
        public override void Load(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream, Encoding.GetEncoding("EUC-KR"));

            string identifier = reader.ReadString(7);

            if (string.Compare(identifier, FILE_IDENTIFIER, false) != 0) {
                throw new FileIdentifierMismatchException(FilePath, FILE_IDENTIFIER, identifier);
            }

            ProjectionType = (ProjectionType)reader.ReadInt32();

            ModelView = reader.ReadMatrix();
            Projection = reader.ReadMatrix();

            FieldOfView = reader.ReadSingle();
            AspectRatio = reader.ReadSingle();
            NearPlane = reader.ReadSingle();
            FarPlane = reader.ReadSingle();

            Eye = reader.ReadVector3();
            Center = reader.ReadVector3();
            Up = reader.ReadVector3();
        }

Usage Example

Ejemplo n.º 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");
        }
All Usage Examples Of Revise.Files.ZCA.CameraFile::Load