Example #1
0
 public void CopyTo(asStream stream)
 {
     stream.Put(R);
     stream.Put(G);
     stream.Put(B);
     stream.Put(A);
 }
Example #2
0
 public ColorRGBA(asStream stream)
 {
     R = stream.GetFloat();
     G = stream.GetFloat();
     B = stream.GetFloat();
     A = stream.GetFloat();
 }
Example #3
0
        public override void Load(asStream stream)
        {
            Resolution = stream.GetShort();
            Stride     = stream.GetShort();

            Unknown = stream.GetShort();

            Flags = stream.GetShort();

            Material = stream.GetShort();
            Texture  = stream.GetShort();
            Physics  = stream.GetShort();

            var numVerts = (Resolution * Stride);

            Vertices = new List <DLPVertex>(numVerts);

            for (int i = 0; i < numVerts; i++)
            {
                var vertex = new DLPVertex(stream);
                Vertices.Add(vertex);
            }

            UserData = stream.GetString();
        }
Example #4
0
        public override void Save(asStream stream)
        {
            stream.PutString(Name, 32);

            stream.Put(Flags);

            stream.Put(Unknown1);
            stream.Put(Unknown2);

            // alignment
            stream.Put((byte)0);
        }
Example #5
0
        static List <T> ParseDB <T>(string filename, string libName, string entriesName)
            where T : agiRefreshable, IAGILibraryData, new()
        {
            var stream = new asStream(filename);

            Console.WriteLine($"Parsing DB: \"{filename}\"");

            var numEntries = stream.GetInt();
            var entries    = new List <T>(numEntries);

            for (int i = 0; i < numEntries; i++)
            {
                var entry = new T();
                entry.Load(stream);

                entries.Add(entry);
            }

            //var writer = new StringBuilder();
            //
            //writer.AppendLine($"# {libName}");
            //writer.AppendLine($"# {entriesName,-12} {entries.Count}");
            //writer.AppendLine();

            //foreach (var entry in entries)
            //{
            //    entry.Print(writer);
            //    writer.AppendLine();
            //}

            //File.WriteAllText(Path.ChangeExtension(filename, ".log"), writer.ToString());

            using (var file = new StreamWriter(Path.ChangeExtension(filename, ".csv")))
                using (var writer = new CsvWriter(file))
                {
                    var writeHeader = true;

                    foreach (var entry in entries)
                    {
                        if (writeHeader)
                        {
                            entry.LibraryHeader(writer);
                            writeHeader = false;
                        }

                        entry.LibrarySave(writer);
                    }

                    file.Flush();
                }

            return(entries);
        }
Example #6
0
        public override void Load(asStream stream)
        {
            Name = stream.GetString(32);

            Flags = stream.GetByte();

            Unknown1 = stream.GetByte();
            Unknown2 = stream.GetByte();

            // ignore alignment
            stream.Skip(1);
        }
Example #7
0
        public override void Save(asStream stream)
        {
            stream.PutString(Name, 32);

            Emission.CopyTo(stream);

            Ambient.CopyTo(stream);
            Diffuse.CopyTo(stream);

            Specular.CopyTo(stream);

            stream.Put(Shininess);
            stream.Put(Reserved);
        }
Example #8
0
        public override void Load(asStream stream)
        {
            int strLen = stream.GetByte();

            Name = stream.GetString(strLen);

            var vertsCount   = stream.GetInt();
            var patchesCount = stream.GetInt();

            Vertices = new short[vertsCount];
            Patches  = new short[patchesCount];

            stream.Get(Vertices, vertsCount);
            stream.Get(Patches, patchesCount);
        }
Example #9
0
        public override void Load(asStream stream)
        {
            Name = stream.GetString(32);

            Emission = new ColorRGBA(stream);

            Ambient = new ColorRGBA(stream);
            Diffuse = new ColorRGBA(stream);

            Specular = new ColorRGBA(stream);

            Shininess = stream.GetFloat();

            Reserved = stream.GetShort();
        }
Example #10
0
        public override void Load(asStream stream)
        {
            Vertex = stream.GetShort();

            Normals = new Vector3()
            {
                X = stream.GetFloat(),
                Y = stream.GetFloat(),
                Z = stream.GetFloat()
            };

            SMap = stream.GetFloat();
            TMap = stream.GetFloat();

            Color = stream.GetInt();
        }
Example #11
0
        public override void Save(asStream stream)
        {
            var strLen = (byte)(Name.Length + 1);

            stream.Put(strLen);
            stream.PutString(Name, strLen);

            var vertsCount   = (Vertices != null) ? Vertices.Length : 0;
            var patchesCount = (Patches != null) ? Patches.Length : 0;

            stream.Put(vertsCount);
            stream.Put(patchesCount);

            stream.Put(Vertices);
            stream.Put(Patches);
        }
Example #12
0
        public override void Save(asStream stream)
        {
            stream.Put(Vertex);

            var norms = new[] {
                Normals.X,
                Normals.Y,
                Normals.Z
            };

            stream.Put(norms, 3);

            stream.Put(SMap);
            stream.Put(TMap);

            stream.Put(Color);
        }
Example #13
0
        public override void Save(asStream stream)
        {
            stream.Put(Resolution);
            stream.Put(Stride);
            stream.Put(Unknown);
            stream.Put(Flags);

            stream.Put(Material);
            stream.Put(Texture);
            stream.Put(Physics);

            foreach (var vertex in Vertices)
            {
                vertex.Save(stream);
            }

            stream.PutString(UserData);
        }
Example #14
0
        public override void Load(asStream stream)
        {
            Name = stream.GetString(32);

            Friction   = stream.GetFloat();
            Elasticity = stream.GetFloat();
            Drag       = stream.GetFloat();

            BumpHeight = stream.GetFloat();
            BumpWidth  = stream.GetFloat();

            SinkDepth = stream.GetFloat();
            PtxRate   = stream.GetFloat();

            Type  = stream.GetInt();
            Sound = stream.GetInt();

            Velocity = new Vector2(stream);
            PtxColor = new ColorRGB(stream);
        }
Example #15
0
        public override void Save(asStream stream)
        {
            stream.PutString(Name, 32);

            stream.Put(Friction);
            stream.Put(Elasticity);
            stream.Put(Drag);

            stream.Put(BumpHeight);
            stream.Put(BumpWidth);

            stream.Put(SinkDepth);
            stream.Put(PtxRate);

            stream.Put(Type);
            stream.Put(Sound);

            Velocity.CopyTo(stream);
            PtxColor.CopyTo(stream);
        }
Example #16
0
 public virtual void Load(asStream stream)
 {
     return;
 }
Example #17
0
 public DLPPatch(DLPFile template, asStream stream)
 {
     Template = template;
     Load(stream);
 }
Example #18
0
 public agiMaterial(asStream stream)
 {
     Load(stream);
 }
Example #19
0
 public DLPTexture(asStream stream)
 {
     Load(stream);
 }
Example #20
0
 protected DLPFile(string filename)
 {
     FileName = filename;
     Stream   = new asStream(filename);
 }
Example #21
0
 public Vector3(asStream stream)
 {
     X = stream.GetFloat();
     Y = stream.GetFloat();
     Z = stream.GetFloat();
 }
Example #22
0
 public void CopyTo(asStream stream)
 {
     stream.Put(X);
     stream.Put(Y);
     stream.Put(Z);
 }
Example #23
0
 public DLPGroup(asStream stream)
 {
     Load(stream);
 }
Example #24
0
 public DLPPhysics(asStream stream)
 {
     Load(stream);
 }
Example #25
0
 public DLPMaterial(asStream stream)
 {
     Load(stream);
 }
Example #26
0
 public virtual void Save(asStream stream)
 {
     return;
 }
Example #27
0
 public agiPhysics(asStream stream)
 {
     Load(stream);
 }
Example #28
0
 public DLPVertex(asStream stream)
 {
     Load(stream);
 }
Example #29
0
 public agiTexture(asStream stream)
 {
     Load(stream);
 }