Esempio n. 1
0
        public void Save(string path)
        {
            BinaryWriter binaryWriter = new BinaryWriter(File.Open(path, FileMode.Create));

            RoseFile.WriteFString(ref binaryWriter, "ZMO0002", 8);
            binaryWriter.Write(this.FPS);
            binaryWriter.Write(this.frameCount);
            binaryWriter.Write(this.channelCount);
            for (int i = 0; i < this.channelCount; i++)
            {
                binaryWriter.Write((int)this.listChannel[i].trackType);
                binaryWriter.Write(this.listChannel[i].trackID);
            }
            for (int i = 0; i < this.frameCount; i++)
            {
                for (int j = 0; j < this.channelCount; j++)
                {
                    if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_NORMAL)
                    {
                        RoseFile.WriteVector3(ref binaryWriter, this.listChannel[j].normal[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_ROTATION)
                    {
                        RoseFile.WriteVector4(ref binaryWriter, this.listChannel[j].rotation[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_POSITION)
                    {
                        RoseFile.WriteVector3(ref binaryWriter, this.listChannel[j].position[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_ALPHA)
                    {
                        binaryWriter.Write(this.listChannel[j].alpha[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV1)
                    {
                        RoseFile.WriteVector2(ref binaryWriter, this.listChannel[j].uv1[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV2)
                    {
                        RoseFile.WriteVector2(ref binaryWriter, this.listChannel[j].uv1[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV3)
                    {
                        RoseFile.WriteVector2(ref binaryWriter, this.listChannel[j].uv1[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_UV4)
                    {
                        RoseFile.WriteVector2(ref binaryWriter, this.listChannel[j].uv1[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_TEXTUREANIM)
                    {
                        binaryWriter.Write(this.listChannel[j].textureAnim[i]);
                    }
                    else if (this.listChannel[j].trackType == ZMO.TrackType.TRACK_TYPE_SCALE)
                    {
                        binaryWriter.Write(this.listChannel[j].scale[i]);
                    }
                }
            }
            binaryWriter.Write(ZMO.unknowData);
            binaryWriter.Close();
        }