public void Save(Stream stream, bool leaveOpen)
        {
            using (var writer = new ResourceWriter(stream, leaveOpen))
            {
                if (ResourceType == ResourceType.AnimationPack)
                {
                    // For AnimationPacks we write a model file header, and then a chunk containing the pack data.
                    writer.WriteFileHeader(ResourceFileIdentifier.Model, Version, ResourceType.Model);
                    writer.WriteResourceChunk(this);
                    return;
                }

                writer.WriteFileHeader(ResourceFileIdentifier.Model, Version, ResourceType);

                switch (ResourceType)
                {
                case ResourceType.Epl:
                    // We have to write this to the file so we can remember it when we load it.
                    writer.WriteBoolean((( Epl )this).IncludesProperties);
                    break;
                }

                Write(writer);
            }
        }
Exemple #2
0
 protected override void WriteCore(ResourceWriter writer)
 {
     writer.WriteFileHeader(ResourceFileIdentifier.ShaderCache, CacheVersion, ResourceType);
     foreach (var shader in this)
     {
         writer.WriteResource(shader);
     }
 }
Exemple #3
0
        public void Save(Stream stream, bool leaveOpen)
        {
            using (var writer = new ResourceWriter(stream, leaveOpen))
            {
                if (ResourceType == ResourceType.AnimationPack)
                {
                    // For AnimationPacks we write a model file header, and then a chunk containing the pack data.
                    writer.WriteFileHeader(ResourceFileIdentifier.Model, Version, ResourceType.ModelPack);
                    writer.WriteResourceChunk(this);
                    return;
                }

                writer.WriteFileHeader(ResourceFileIdentifier.Model, Version, ResourceType);

                switch (ResourceType)
                {
                case ResourceType.Epl:
                    // We have to write this to the file so we can remember it when we load it.
                    //writer.WriteBoolean( ( ( Epl ) this ).IncludesProperties );
                    break;

                case ResourceType.Node:
                    Node.WriteRecursive(writer, ( Node )this);
                    return;

                case ResourceType.ChunkType000100F8:
                {
                    var chunk = ( ChunkType000100F8 )this;
                    writer.WriteInt32(chunk.Data.Length);
                    writer.WriteBytes(chunk.Data);
                    return;
                }
                }

                WriteCore(writer);
            }
        }