private static bool SchematicToVox(AbstractToSchematic converter) { Schematic schematic = converter.WriteSchematic(); Console.WriteLine($"[INFO] Vox Width: {schematic.Width}"); Console.WriteLine($"[INFO] Vox Length: {schematic.Length}"); Console.WriteLine($"[INFO] Vox Height: {schematic.Height}"); if (schematic.Width > Schematic.MAX_WORLD_WIDTH || schematic.Length > Schematic.MAX_WORLD_LENGTH || schematic.Height > Schematic.MAX_WORLD_HEIGHT) { Console.WriteLine("[ERROR] Model is too big ! MagicaVoxel can't support model bigger than 2000x2000x1000"); return(false); } VoxWriter writer = new VoxWriter(); if (INPUT_PALETTE_FILE != null) { PaletteSchematicConverter converterPalette = new PaletteSchematicConverter(INPUT_PALETTE_FILE); schematic = converterPalette.ConvertSchematic(schematic); return(writer.WriteModel(FormatOutputDestination(OUTPUT_PATH), converterPalette.GetPalette(), schematic)); } if (INPUT_SHADER_FILE != null) { JsonToSchematic jsonParser = new JsonToSchematic(INPUT_SHADER_FILE, schematic); schematic = jsonParser.WriteSchematic(); } return(writer.WriteModel(FormatOutputDestination(OUTPUT_PATH), null, schematic)); }
private static void SchematicToVox(AbstractToSchematic converter, string outputPath) { Schematic schematic = converter.WriteSchematic(); Console.WriteLine($"[INFO] Vox Width: {schematic.Width}"); Console.WriteLine($"[INFO] Vox Length: {schematic.Length}"); Console.WriteLine($"[INFO] Vox Height: {schematic.Height}"); if (schematic.Width > MAX_WORLD_WIDTH || schematic.Length > MAX_WORLD_LENGTH || schematic.Height > MAX_WORLD_HEIGHT) { Console.WriteLine("[ERROR] Voxel model is too big ! MagicaVoxel can't support model bigger than 2000^3"); return; } VoxWriter writer = new VoxWriter(); if (_inputPaletteFile != null) { PaletteSchematicConverter converterPalette = new PaletteSchematicConverter(_inputPaletteFile, _colorLimit); schematic = converterPalette.ConvertSchematic(schematic); writer.WriteModel(_chunkSize, outputPath + ".vox", converterPalette.GetPalette(), schematic); } else { writer.WriteModel(_chunkSize, outputPath + ".vox", null, schematic); } }
private static bool SchematicToVox(AbstractToSchematic converter, string outputPath) { Schematic schematic = converter.WriteSchematic(); Console.WriteLine($"[INFO] Vox Width: {schematic.Width}"); Console.WriteLine($"[INFO] Vox Length: {schematic.Length}"); Console.WriteLine($"[INFO] Vox Height: {schematic.Height}"); if (schematic.Width > Schematic.MAX_WORLD_WIDTH || schematic.Length > Schematic.MAX_WORLD_LENGTH || schematic.Height > Schematic.MAX_WORLD_HEIGHT) { Console.WriteLine("[ERROR] Model is too big ! MagicaVoxel can't support model bigger than 2000x2000x1000"); return(false); } VoxWriter writer = new VoxWriter(); if (INPUT_PALETTE_FILE != null) { PaletteSchematicConverter converterPalette = new PaletteSchematicConverter(INPUT_PALETTE_FILE, COLOR_LIMIT); schematic = converterPalette.ConvertSchematic(schematic); return(writer.WriteModel(CHUNK_SIZE, outputPath + ".vox", converterPalette.GetPalette(), schematic)); } return(writer.WriteModel(CHUNK_SIZE, outputPath + ".vox", null, schematic)); }