void CreateTerrianModel(VoxelTerrain terrian, string meshName, string tempfilePath) { Cursor = Cursors.WaitCursor; //Save the voxel terrian to a tempory file. terrian.SaveTo(tempfilePath); //Pull the file through the pipeline. contentBuilder.Clear(); contentBuilder.Add(tempfilePath, meshName, "VoxelTerrianImporter", "ModelProcessor"); string buildError = contentBuilder.Build(); //Now we can treat the terrian as a normal model. if (string.IsNullOrEmpty(buildError)) { Model terrianModel = contentManager.Load <Model>(meshName); editorViewerControl.UnpauseForm(); editorViewerControl.TerrianModel = terrianModel; gameManifest.TerrianModels["Terrain\\" + meshName] = terrianModel; } else { MessageBox.Show("An error occured while generating the mesh:\n" + buildError, "Error"); } Cursor = Cursors.Default; }
void CreateTerrianModel(VoxelTerrain terrian, string meshName, string tempfilePath) { Cursor = Cursors.WaitCursor; //Save the voxel terrian to a tempory file. terrian.SaveTo(tempfilePath); //Pull the file through the pipeline. contentBuilder.Clear(); contentBuilder.Add(tempfilePath, meshName, "VoxelTerrianImporter", "ModelProcessor"); string buildError = contentBuilder.Build(); //Now we can treat the terrian as a normal model. if(string.IsNullOrEmpty(buildError)) { Model terrianModel = contentManager.Load<Model>(meshName); editorViewerControl.UnpauseForm(); editorViewerControl.TerrianModel = terrianModel; gameManifest.TerrianModels["Terrain\\" + meshName] = terrianModel; } else { MessageBox.Show("An error occured while generating the mesh:\n" + buildError, "Error"); } Cursor = Cursors.Default; }