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); }
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); }
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); }
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(); }