static void Main(string[] args) { FilePaths filePaths = ArgParser.Parse(args); AssimpInterpreter interpreter = new AssimpInterpreter(); Structure structure = interpreter.Interpret(filePaths.inFile); NodeGraph nodeGraph = null; // Voxel solution. if (filePaths.voxelSolution) { nodeGraph = VoxelGridGraphGenerator.GenerateNodeGraph(structure); } // Mesh solution. else { List <NodeGraph> nodeGraphs = new List <NodeGraph>(); for (int i = 0; i < structure.components.Count; i++) { NodeGraph n = ComponentGraphGenerator.GenerateComponentNodeGraph(structure.components[i]); nodeGraphs.Add(n); } nodeGraph = GraphUnifier.UnifyGraphs(nodeGraphs); } XMLCreator.writeXML(nodeGraph, filePaths.outFile); }
/* * Parse arguments into an input and output path, and decides which graph generator solution to choose. */ public static FilePaths Parse(string[] args) { CheckValidArgs(args); FilePaths filePath = new FilePaths( GetInputPath(args[0]), GetOutputPath(args[1])); SetFlags(args, filePath); return(filePath); }
/* * Sets all flags based on arguments */ private static void SetFlags(string[] args, FilePaths filePaths) { SetDefaultFlags(filePaths); for (int i = flagIndex; i < args.Length; i++) { string flag = args[i].Substring(1); if (flagsDictionary["MeshSolution"] == flag) { filePaths.voxelSolution = false; } else if (flagsDictionary["VoxelSolution"] == flag) { filePaths.voxelSolution = true; } } }
/* * Sets default flags */ private static void SetDefaultFlags(FilePaths filePaths) { filePaths.voxelSolution = true; }