/// <summary> /// Runs the current Decomposition Method on the input mesh /// </summary> /// <param name="inputMesh">Mesh to decompose</param> /// <returns></returns> public SharpMesh.Decomposer.DecomposerResult Run(SharpMesh.Data.Mesh inputMesh) { switch (method) { case Method.Voxel: if (!(options is VoxelOptions)) { options = new VoxelOptions(); } return(new SharpMesh.Decomposer.Voxel.VoxelDecomposer(inputMesh, ((VoxelOptions)options).Create()).Run()); default: Debug.LogError("Unknown Method"); return(null); } }
/// <summary> /// Changes the method and updates internal state accordingly. /// </summary> /// <param name="newMethod"></param> public void SetMethod(Method newMethod) { // No need to change method and overwrite settings for no reason if (method == newMethod) { return; } switch (newMethod) { case Method.Voxel: Debug.Log("Creating new Voxel Decomposer"); options = new VoxelOptions(); break; default: Debug.LogError("Unknown method."); break; } method = newMethod; }