public void SaveOwlVoxelModel(OwlVoxelModel ovm, string name) { FileManagement.SaveOwlVoxelModel( FindObjectOfType <VoxelDisplay>().GenerateOVM(), FindObjectOfType <InputField>().text ); }
public void DisplayVoxelModel(OwlVoxelModel ovm) { if (ovm == null) { return; } foreach (OwlVoxel voxel in ovm.voxels) { CreateVoxel(voxel); } }
public static OwlVoxelModel LoadOwlVoxelModel(string name) { if (File.Exists(path + name + ".ovm")) { BinaryFormatter binaryFormatter = new BinaryFormatter(); FileStream fileStream = new FileStream(path + name + ".ovm", FileMode.Open); OwlVoxelModel loadedModel = binaryFormatter.Deserialize(fileStream) as OwlVoxelModel; fileStream.Close(); return(loadedModel); } return(null); }
public static void SaveOwlVoxelModel(OwlVoxelModel ovm, string name) { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } BinaryFormatter binaryFormatter = new BinaryFormatter(); FileStream fileStream = new FileStream(path + name + ".ovm", FileMode.OpenOrCreate); binaryFormatter.Serialize(fileStream, ovm); fileStream.Close(); SetCurrentOVM(name); }
public OwlVoxelModel GenerateOVM() { OwlVoxelModel newOVM = new OwlVoxelModel(); List <OwlVoxel> voxels = new List <OwlVoxel>(); foreach (Transform child in transform) { OwlVoxel newVoxel = new OwlVoxel(); newVoxel.x = (int)child.localPosition.x; newVoxel.y = (int)child.localPosition.y; newVoxel.z = (int)child.localPosition.z; voxels.Add(newVoxel); } newOVM.AddVoxels(voxels.ToArray()); return(newOVM); }