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

Save() public method

Saves the file to the specified stream.
public Save ( Stream stream ) : void
stream System.IO.Stream The stream to save to.
return void
        public override void Save(Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream, Encoding.GetEncoding("EUC-KR"));

            writer.WriteString(FILE_IDENTIFIER);
            writer.Write((int)ProjectionType);

            writer.Write(ModelView);
            writer.Write(Projection);

            writer.Write(FieldOfView);
            writer.Write(AspectRatio);
            writer.Write(NearPlane);
            writer.Write(FarPlane);

            writer.Write(Eye);
            writer.Write(Center);
            writer.Write(Up);
        }

Usage Example

コード例 #1
0
ファイル: CameraFileTests.cs プロジェクト: Jiwan/Revise
        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");
        }