private void StartGenerating() { if (importHeightMap) { heightMap = ExternalHeightMapReceiver.Generate(); Debug.Log("Height map"); } else { switch (generationAlgorithm) { case GenerationAlgorithm.PerlinNoise: { heightMap = PerlinNoiseGenerator.Generate(mapSize); break; } case GenerationAlgorithm.DiamondSquare: { heightMap = DiamondSquareGenerator.Generate(mapSize); break; } } } var mapGen = (MapGenerator)target; switch (optimizationMethod) { case Optimization.LevelOfDetail: { optimizedMap = LevelOfDetailOptimizer.Optimize(heightMap); mapGen.GenerateRegularMesh(optimizedMap); break; } case Optimization.RamerDouglasPecker: { optimizedMap = RamerDouglasPeckerOptimizer.Optimize(heightMap, PerlinNoiseGenerator._heightMultiplier); mapGen.GenerateIrregularMesh(optimizedMap, mapSize); break; } case Optimization.None: { mapGen.GenerateRegularMesh(heightMap); Debug.Log("Bulding"); break; } } }
private void SetOptimizationAlgorithmUI() { switch (optimizationMethod) { case Optimization.LevelOfDetail: LevelOfDetailOptimizer.Draw(mapSize); break; case Optimization.RamerDouglasPecker: RamerDouglasPeckerOptimizer.Draw(); break; case Optimization.None: EditorGUILayout.Space(); break; default: throw new ArgumentOutOfRangeException(); } }