Пример #1
0
        private static void ProcessFile()
        {
            if (!File.Exists(_inputFile))
            {
                throw new FileNotFoundException("[ERROR] Input file not found", _inputFile);
            }
            try
            {
                BaseToSchematic converter;

                switch (Path.GetExtension(_inputFile))
                {
                case ".schematic":
                    converter = new SchematicToSchematic(_inputFile, _ignoreMinY, _ignoreMaxY, _excavate, _scale);
                    break;

                case ".png":
                    converter = new PNGToSchematic(_inputFile, _inputColorFile, _heightmap, _excavate, _color, _top);
                    break;

                case ".asc":
                    converter = new ASCToSchematic(_inputColorFile);
                    break;

                case ".binvox":
                    converter = new BinvoxToSchematic(_inputFile);
                    break;

                case ".qb":
                    converter = new QbToSchematic(_inputColorFile);
                    break;

                case ".obj":
                    converter = new ObjToSchematic(_inputFile, _gridSize, _excavate, _slow);
                    break;

                default:
                    Console.WriteLine("[ERROR] Unknown file extension !");
                    Console.ReadKey();
                    return;
                }

                Schematic schematic = converter.WriteSchematic();
                VoxWriter writer    = new VoxWriter();
                writer.WriteModel(_outputFile + ".vox", schematic, _direction);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Console.ReadLine();
            }
        }
Пример #2
0
 private static void ProcessImageFile()
 {
     try
     {
         Schematic schematic = PNGToSchematic.WriteSchematic(_inputFile, _inputColorFile, _heightmap, _excavate, _color, _top);
         VoxWriter writer    = new VoxWriter();
         writer.WriteModel(_outputFile + ".vox", schematic, _direction);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         Console.ReadLine();
     }
 }
Пример #3
0
        private static void ProcessFile()
        {
            string path = Path.GetFullPath(_inputFile);

            if (!File.Exists(path))
            {
                throw new FileNotFoundException("[ERROR] Input file not found", _inputFile);
            }
            try
            {
                AbstractToSchematic converter;
                switch (Path.GetExtension(_inputFile))
                {
                case ".schematic":
                    converter = new SchematicToSchematic(path, _ignoreMinY, _ignoreMaxY, _excavate, _scale);
                    break;

                case ".png":
                    converter = new PNGToSchematic(path, _inputColorFile, _heightmap, _excavate, _color, _top);
                    break;

                case ".tif":
                    converter = new TIFtoSchematic(path, _inputColorFile, _heightmap, _excavate, _color, _top);
                    break;

                case ".asc":
                    converter = new ASCToSchematic(path);
                    break;

                case ".binvox":
                    converter = new BinvoxToSchematic(path);
                    break;

                case ".qb":
                    converter = new QBToSchematic(path);
                    break;

                case ".obj":
                    converter = new OBJToSchematic(path, _gridSize, _excavate, _slow);
                    break;

                case ".ply":
                    converter = new PLYToSchematic(path, _scale);
                    break;

                case ".xyz":
                    converter = new XYZToSchematic(path, _scale);
                    break;

                case ".csv":
                    converter = new CSVToSchematic(path, _scale);
                    break;

                default:
                    Console.WriteLine("[ERROR] Unknown file extension !");
                    Console.ReadKey();
                    return;
                }

                Schematic schematic = converter.WriteSchematic();
                Console.WriteLine($"[INFO] Vox Width: {schematic.Width}");
                Console.WriteLine($"[INFO] Vox Length: {schematic.Length}");
                Console.WriteLine($"[INFO] Vox Height: {schematic.Heigth}");
                VoxWriter writer = new VoxWriter();
                writer.WriteModel(_outputFile + ".vox", schematic, _direction);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Console.ReadLine();
            }
        }