public static LiquidData Read(Stream s, LiquidHeader header) { var r = new BinaryReader(s); var ret = new LiquidData { HeightMap = new float[header.CountXVertices,header.CountYVertices], RenderFlags = new byte[header.Width,header.Height] }; for (int y = 0; y < header.CountYVertices; y++) { for (int x = 0; x < header.CountXVertices; x++) { r.ReadUInt32(); ret.HeightMap[x, y] = r.ReadSingle(); } } for (int y = 0; y < header.Height; y++) { for (int x = 0; x < header.Width; x++) { ret.RenderFlags[x, y] = r.ReadByte(); } } return ret; }
public static LiquidData Read(Stream s, LiquidHeader header) { var r = new BinaryReader(s); var ret = new LiquidData { HeightMap = new float[header.CountXVertices, header.CountYVertices], RenderFlags = new byte[header.Width, header.Height] }; for (int y = 0; y < header.CountYVertices; y++) { for (int x = 0; x < header.CountXVertices; x++) { r.ReadUInt32(); ret.HeightMap[x, y] = r.ReadSingle(); } } for (int y = 0; y < header.Height; y++) { for (int x = 0; x < header.Width; x++) { ret.RenderFlags[x, y] = r.ReadByte(); } } return(ret); }
public static LiquidHeader Read(Stream s) { var ret = new LiquidHeader(); var r = new BinaryReader(s); ret.CountXVertices = r.ReadUInt32(); ret.CountYVertices = r.ReadUInt32(); ret.Width = r.ReadUInt32(); ret.Height = r.ReadUInt32(); ret.BaseLocation = Vector3Helper.Read(s); ret.MaterialId = r.ReadUInt16(); return(ret); }
private void ReadLiquid() { var chunk = SubData.GetChunkByName("MLIQ"); if (chunk == null) { return; } HasLiquidData = true; var stream = chunk.GetStream(); LiquidDataHeader = LiquidHeader.Read(stream); LiquidDataGeometry = LiquidData.Read(stream, LiquidDataHeader); }
public static LiquidHeader Read(Stream s) { var ret = new LiquidHeader(); var r = new BinaryReader(s); ret.CountXVertices = r.ReadUInt32(); ret.CountYVertices = r.ReadUInt32(); ret.Width = r.ReadUInt32(); ret.Height = r.ReadUInt32(); ret.BaseLocation = Vector3Helper.Read(s); ret.MaterialId = r.ReadUInt16(); return ret; }