// use when loading public TerrainBuilder(TerrainSettings settings) { Settings = settings; Seed = settings.seed; Width = settings.width; Height = settings.height; NoiseModule = FileManager.LoadObject <IModule> (settings.moduleFile, true); _presetLoader = new GradiantPresetLoader(GameServer.Instance.AppDirectory + "GradientPresets" + GameServer.sepChar); GradientPreset = _presetLoader.GetPreset(settings.preset); Gradient = GradientCreator.CreateGradientServer(new List <GradientPresets.GradientKeyData>(GradientPreset)); LoadMap(settings.imageFile); }
// use when creating public bool Generate(IModule module, string preset) { NoiseModule = module; GradientPreset = _presetLoader.GetPreset(preset); if (GradientPreset != null && module != null) { NoiseMap = new Noise2D(Width, Height, NoiseModule); //_noiseMap.GeneratePlanar (0, 4, 0, 2); NoiseMap.GenerateSpherical(-90, 90, -180, 180); Logger.Log("terrain generated."); Gradient = GradientCreator.CreateGradientServer(new List <GradientPresets.GradientKeyData>(GradientPreset)); ColorMap = ColorConvert.SysColList(NoiseMap.GetTexture(Gradient)); Logger.Log("bitmap generated."); Settings.preset = preset; return(true); } else { Logger.LogError("Generate: Gradient Preset is null!"); } return(false); }