コード例 #1
0
        public static VoxelData OpenSlab(string fileName)
        {
            var result = new VoxelData();
            using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
            {
                using (var br = new BinaryReader(fs))
                {
                    result.Width = br.ReadInt32();
                    result.Height = br.ReadInt32();
                    result.Depth = br.ReadInt32();

                    var byteData = br.ReadBytes(result.Width*result.Depth*result.Height);
                    result.Data = byteData;

                }
            }
            return result;
        }
コード例 #2
0
        public static VoxelData OpenXRaw(string fileName)
        {
            var result = new VoxelData();
            using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
            {
                using (var br = new BinaryReader(fs))
                {
                    char[] sign = br.ReadChars(4);
                    Console.WriteLine(sign.ToString());
                    int data = br.ReadInt32();
                    result.Width = br.ReadInt32();
                    result.Height = br.ReadInt32();
                    result.Depth = br.ReadInt32();

                    var byteData = br.ReadBytes(result.Width*result.Depth*result.Height);
                    result.Data = byteData;

                }
            }
            return result;
        }