Ejemplo n.º 1
0
        private void readVoxFile(TextAsset voxFile)
        {
            Stream sw = new MemoryStream(voxFile.bytes);

            System.IO.BinaryReader br = new System.IO.BinaryReader(sw);
            var        vs             = VoxelFormater.ReadFromMagicaVoxel(br);
            SplitVoxel split          = new SplitVoxel(vs);

            for (int i = 0; i < _boxes.Count; ++i)
            {
                split.addBox(_boxes[i]);
            }
            VoxelStruct[] vses = split.doIt();
            _items.Clear();
            for (int i = 0; i < vses.Length; ++i)
            {
                vses [i].arrange();
                string md5  = VoxelFormater.GetMd5(vses [i]);
                Item   item = new Item();
                item.voxel = vses [i];
                item._MD5  = md5;
                item.data  = CreateData(md5, vses [i]);
                _items.Add(item);
            }
        }
Ejemplo n.º 2
0
        public VoxelStruct createStruct(TextAsset voxFile)
        {
            Stream sw = new MemoryStream(voxFile.bytes);

            System.IO.BinaryReader br = new System.IO.BinaryReader(sw);
            var vs = VoxelFormater.ReadFromMagicaVoxel(br);

            return(vs);
        }
Ejemplo n.º 3
0
 public override void read()
 {
     if (_voxFile != null)
     {
         Stream sw = new MemoryStream(_voxFile.bytes);
         System.IO.BinaryReader br = new System.IO.BinaryReader(sw);
         if (_model != null)
         {
             VoxelStruct vs = VoxelFormater.ReadFromMagicaVoxel(br);
             _model.data = vs.datas.ToArray();
             _model.vs   = vs;
         }
     }
 }