public static VoxelObject LoadVoxelObject(string filePath, BufferUsageHint usageHint)
        {
            if (GlobalNetwork.IsServer)
            {
                return(null);
            }

            VoxelObject vo;

            if (models.TryGetValue(filePath, out vo))
            {
                return(vo);
            }
            else
            {
                if (VoxelIO.Load(filePath, out vo))
                {
                    vo.BuildMesh(usageHint);
                    models.Add(filePath, vo);
                    return(vo);
                }
                else
                {
                    throw new FileNotFoundException(string.Format("Failed to load model {0}!", filePath));
                }
            }
        }
        public void SaveModel()
        {
            if (CurrentFile == null)
            {
                throw new InvalidOperationException("File has not yet been saved!");
            }

            VoxelIO.Save(CurrentFile, Model);
        }
        public void LoadModel(string name)
        {
            VoxelObject tmpObj = null;

            if (VoxelIO.Load(name, out tmpObj))
            {
                Model = new VoxelEditorObject(tmpObj);
                Window.UpdateTitle(name);
                CurrentFile = name;

                if (voxelGrid != null)
                {
                    voxelGrid.Dispose();
                }

                voxelGrid = new VoxelGridObject(Model);
                Camera.Active.SetTarget(Model.CenterPosition);
            }
        }
 public void SaveModel(string filePath)
 {
     VoxelIO.Save(filePath, Model);
 }