protected override void OnUpdate(GameTime gameTime) { MiniMap.PlayerLocation = World.Player.KnownPosition; var args = new UpdateArgs() { Camera = World.Camera, GraphicsDevice = Graphics, GameTime = gameTime }; _playingHud.CheckInput = Alex.GuiManager.ActiveDialog == null; // if (Alex.IsActive) if (Math.Abs(AspectRatio - Graphics.Viewport.AspectRatio) > 0f) { World.Camera.UpdateAspectRatio(Graphics.Viewport.AspectRatio); AspectRatio = Graphics.Viewport.AspectRatio; } if (!_playingHud.Chat.Focused && Alex.GameStateManager.GetActiveState() is PlayingState) { World.Player.Controller.CheckMovementInput = Alex.IsActive && Alex.GuiManager.ActiveDialog == null; World.Player.Controller.CheckInput = Alex.IsActive; if (Alex.GuiManager.ActiveDialog == null) { CheckInput(gameTime); } } else { World.Player.Controller.CheckInput = false; } World.Update(args); var now = DateTime.UtcNow; if (now - _previousMemUpdate > TimeSpan.FromSeconds(5)) { _previousMemUpdate = now; _ramUsage = Environment.WorkingSet; ThreadPool.GetMaxThreads(out int maxThreads, out _); ThreadPool.GetAvailableThreads(out int availableThreads, out _); _threadsUsed = maxThreads - availableThreads; _maxThreads = maxThreads; var pos = World.Player.KnownPosition.GetCoordinates3D(); var biomeId = World.GetBiome(pos.X, pos.Y, pos.Z); var biome = BiomeUtils.GetBiomeById(biomeId); _currentBiomeId = biomeId; _currentBiome = biome; } base.OnUpdate(gameTime); }
protected override void OnUpdate(GameTime gameTime) { var args = new UpdateArgs() { Camera = World.Camera, GraphicsDevice = Graphics, GameTime = gameTime }; // if (Alex.IsActive) { var newAspectRatio = Graphics.Viewport.AspectRatio; if (AspectRatio != newAspectRatio) { World.Camera.UpdateAspectRatio(newAspectRatio); AspectRatio = newAspectRatio; } UpdateRayTracer(Alex.GraphicsDevice, World); if (!_playingHud.Chat.Focused) { World.Player.Controller.CheckInput = Alex.IsActive; CheckInput(gameTime); } else { World.Player.Controller.CheckInput = false; } SkyRenderer.Update(args); World.Update(args, SkyRenderer); var now = DateTime.UtcNow; if (now - _previousMemUpdate > TimeSpan.FromSeconds(5)) { _previousMemUpdate = now; //Task.Run(() => { _ramUsage = Environment.WorkingSet; ThreadPool.GetMaxThreads(out int maxThreads, out int maxCompletionPorts); ThreadPool.GetAvailableThreads(out int availableThreads, out int availableComplPorts); _threadsUsed = maxThreads - availableThreads; _complPortUsed = maxCompletionPorts - availableComplPorts; _maxThreads = maxThreads; _maxComplPorts = maxCompletionPorts; var pos = World.Player.KnownPosition.GetCoordinates3D(); var biomeId = World.GetBiome(pos.X, pos.Y, pos.Z); var biome = BiomeUtils.GetBiomeById(biomeId); _currentBiomeId = biomeId; _currentBiome = biome; } //); } } base.OnUpdate(gameTime); }
public override void OnNodeGUI() { if (obj != null) { if (!firstRender && e.type != EventType.Layout) { return; } firstRender = true; Type objType = obj.GetType(); EditorGUILayout.LabelField(obj.ToString()); if (objType.IsGenericType && objType.GetGenericTypeDefinition() == typeof(PWArray <>)) { var pwv = obj as PWArray <object>; for (int i = 0; i < pwv.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("[" + i + "] " + pwv.NameAt(i) + ": " + pwv.At(i), GUILayout.Width(300)); EditorGUILayout.EndHorizontal(); } } else if (objType == typeof(Vector2)) { EditorGUILayout.Vector2Field("vec2", (Vector2)obj); } else if (objType == typeof(Vector3)) { EditorGUILayout.Vector2Field("vec3", (Vector3)obj); } else if (objType == typeof(Vector4)) { EditorGUILayout.Vector2Field("vec4", (Vector4)obj); } else if (objType == typeof(Sampler2D)) { PWGUI.Sampler2DPreview(obj as Sampler2D); } else if (objType == typeof(Sampler3D)) { } else if (objType == typeof(BiomeData)) { BiomeUtils.DrawBiomeInfos(rect, obj as BiomeData); } } else { EditorGUILayout.LabelField("null"); } }
public TextureLayerRenderer(TextureRendererConfig config) { if (config.ResourcePack.Equals("default", System.StringComparison.InvariantCultureIgnoreCase)) { ResourcePack = new Texture.ResourcePack(); } else { ResourcePack = new Texture.ResourcePack(config.ResourcePack); } BiomeUtils = new BiomeUtils(); BiomeUtils.PrecomputeBiomeColors(); }
public BiomeMapForm(Level level) { _level = level; _biomeUtils = new BiomeUtils(); _biomeUtils.PrecomputeBiomeColors(); InitializeComponent(); Closing += (sender, args) => { _cancelProgress = true; }; }
public override void OnNodeGUI() { if (obj != null) { Type objType = obj.GetType(); EditorGUILayout.LabelField(obj.ToString()); if (objType == typeof(PWValues)) { var pwv = obj as PWValues; for (int i = 0; i < pwv.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("[" + i + "] " + pwv.NameAt(i) + ": " + pwv.At(i), GUILayout.Width(300)); EditorGUILayout.EndHorizontal(); } } else if (objType == typeof(Vector2)) { EditorGUILayout.Vector2Field("vec2", (Vector2)obj); } else if (objType == typeof(Vector3)) { EditorGUILayout.Vector2Field("vec3", (Vector3)obj); } else if (objType == typeof(Vector4)) { EditorGUILayout.Vector2Field("vec4", (Vector4)obj); } else if (objType == typeof(Sampler2D)) { //TODO } else if (objType == typeof(Sampler3D)) { //TODO } else if (objType == typeof(BiomeData)) { BiomeUtils.DrawBiomeInfos(obj as BiomeData); } } else { EditorGUILayout.LabelField("null"); } }
protected void GetVertices(IBlockAccess world, ChunkData chunkBuilder, BlockCoordinates blockCoordinates, Vector3 position, Block baseBlock, BlockStateModel[] models) { { var biome = world == null?BiomeUtils.GetBiomeById(0) : world.GetBiome(position); if (UseRandomizer) { BlockStateModel selectedModel = null; var rnd = MathF.Abs(NoiseGenerator.GetValue(position.X * position.Y, position.Z * position.X)) * WeightSum; for (var index = 0; index < models.Length; index++) { var model = models[index]; rnd -= model.Weight; if (rnd < 0) { selectedModel = model; break; } } CalculateModel( world, blockCoordinates, chunkBuilder, position, baseBlock, selectedModel, biome); } else { for (var bsModelIndex = 0; bsModelIndex < models.Length; bsModelIndex++) { var bsModel = models[bsModelIndex]; if (bsModel.Model == null) { continue; } CalculateModel( world, blockCoordinates, chunkBuilder, position, baseBlock, bsModel, biome); } } } }
public override void OnNodeGUI() { GUILayout.Space(14); PWGUI.PWArrayField(outputValues); EditorGUILayout.LabelField("Preview graph"); previewGraph = EditorGUILayout.ObjectField(previewGraph, typeof(PWMainGraph), false) as PWMainGraph; if (previewGraph == null) { EditorGUILayout.HelpBox("Can't process the graph without a preview graph ", MessageType.Error); } if (outputPartialBiome != null) { BiomeUtils.DrawBiomeInfos(rect, outputPartialBiome.biomeDataReference); } calls = 0; }
private void GenerateChunk(int chunkSize) { chunkBlocks = new Block[chunkSize, chunkSize, chunkSize]; Biome biome = BiomeUtils.SelectBiome(this.chunkObject.transform.position); for (int z = 0; z < chunkSize; z++) { for (int y = 0; y < chunkSize; y++) { for (int x = 0; x < chunkSize; x++) { float worldX = x + chunkObject.transform.position.x; float worldY = y + chunkObject.transform.position.y; float worldZ = z + chunkObject.transform.position.z; BlockType biomeBlock = biome.GenerateTerrain(worldX, worldY, worldZ); chunkBlocks[x, y, z] = new Block(biomeBlock, this, new Vector3(x, y, z)); if (biomeBlock == World.blockTypes[BlockType.Type.AIR]) { this.status = chunkStatus.TO_DRAW; } } } } if (status == chunkStatus.TO_DRAW) { string chunkName = (int)this.chunkObject.transform.position.x + "_" + ((int)this.chunkObject.transform.position.y - 16) + "_" + (int)this.chunkObject.transform.position.z; Chunk chunkBelow; if (World.chunks.TryGetValue(chunkName, out chunkBelow)) { chunkBelow.status = chunkStatus.TO_DRAW; } } }
private Biome GetBiome(float x, float z) { x /= CoordinateScale; z /= CoordinateScale; var mX = x + BiomeModifierX.GetValue(x, z); var mZ = z + BiomeModifierZ.GetValue(x, z); var temp = TempNoise.GetValue(mX, mZ) * 3.024F; var rain = RainNoise.GetValue(mX, mZ); if (temp < -1f) { temp = -(temp % 1); } if (rain < 0) { rain = -rain; } return(BiomeUtils.GetBiome(temp, rain)); }
public override void GetVertices(IBlockAccess world, ChunkData chunkBuilder, BlockCoordinates blockCoordinates, Vector3 position, Block baseBlock) { var biome = world == null?BiomeUtils.GetBiomeById(0) : world.GetBiome(position); if (UseRandomizer) { BlockStateModelWrapper selectedModel = null; var rnd = MathF.Abs(NoiseGenerator.GetValue(position.X * position.Y, position.Z * position.X)) * WeightSum; for (var index = 0; index < Models.Length; index++) { var model = Models[index]; rnd -= model.BlockStateModel.Weight; if (rnd < 0) { selectedModel = model; break; } } CalculateModel(world, blockCoordinates, chunkBuilder, position, baseBlock, selectedModel.BlockStateModel, selectedModel.BlockModel, biome); } else { for (var bsModelIndex = 0; bsModelIndex < Models.Length; bsModelIndex++) { var bsModel = Models[bsModelIndex]; // if (string.IsNullOrWhiteSpace(bsModel.ModelName)) continue; CalculateModel(world, blockCoordinates, chunkBuilder, position, baseBlock, bsModel.BlockStateModel, bsModel.BlockModel, biome); } } }
protected VerticesResult GetVertices(IBlockAccess world, Vector3 position, Block baseBlock, BlockStateModel[] models) { var verts = new List <BlockShaderVertex>(); { var indexResult = new List <int>(24 * models.Length); var animatedIndexResult = new List <int>(); int biomeId = 0; //world == null ? 0 : world.GetBiome((int) position.X, 0, (int) position.Z); var biome = BiomeUtils.GetBiomeById(biomeId); if (UseRandomizer) { //var rndIndex = FastRandom.Next() % Models.Length; CalculateModel( world, position, baseBlock, models[0], verts, indexResult, animatedIndexResult, biomeId, biome); } else { for (var bsModelIndex = 0; bsModelIndex < models.Length; bsModelIndex++) { var bsModel = models[bsModelIndex]; if (bsModel.Model == null) { continue; } CalculateModel( world, position, baseBlock, bsModel, verts, indexResult, animatedIndexResult, biomeId, biome); } } return(new VerticesResult(verts.ToArray(), indexResult.ToArray(), animatedIndexResult.Count > 0 ? animatedIndexResult.ToArray() : null)); } }
protected (VertexPositionNormalTextureColor[] vertices, int[] indexes) GetVertices(IBlockAccess world, Vector3 position, Block baseBlock, BlockStateModel[] models) { using (var verts = new PooledList <VertexPositionNormalTextureColor>(ClearMode.Auto)) { var indexResult = new List <int>(24 * models.Length); int biomeId = 0; //world == null ? 0 : world.GetBiome((int) position.X, 0, (int) position.Z); var biome = BiomeUtils.GetBiomeById(biomeId); if (UseRandomizer) { //var rndIndex = FastRandom.Next() % Models.Length; CalculateModel( world, position, baseBlock, models[0], verts, indexResult, biomeId, biome); } else { for (var bsModelIndex = 0; bsModelIndex < models.Length; bsModelIndex++) { var bsModel = models[bsModelIndex]; if (bsModel.Model == null) { continue; } CalculateModel( world, position, baseBlock, bsModel, verts, indexResult, biomeId, biome); } } return(verts.ToArray(), indexResult.ToArray()); } }
public override void OnNodeProcess() { //TODO: 3D biome map management BiomeUtils.ApplyBiomeTerrainModifiers(inputBlendedBiomes); terrainOutput.biomeMap = inputBlendedBiomes.biomeMap; terrainOutput.biomeMap3D = inputBlendedBiomes.biomeMap3D; terrainOutput.albedoMaps = inputBlendedBiomes.terrainTextureArray; //TODO: apply geologic layer (rivers / oth) //TODO: place vegetation / small details //assign everything needed to the output chunk: terrainOutput.size = chunkSize; if (outputMaps[0].active) { terrainOutput.terrain = inputBlendedBiomes.terrain; } if (outputMaps[1].active) { terrainOutput.wetnessMap = inputBlendedBiomes.wetnessMap; } if (outputMaps[2].active) { terrainOutput.temperatureMap = inputBlendedBiomes.temperatureMap; } if (outputMaps[3].active) { terrainOutput.airMap = inputBlendedBiomes.airMap; } if (outputMaps[4].active) { terrainOutput.lightingMap = inputBlendedBiomes.lightingMap; } }
public override void GetVertices(IBlockAccess world, ChunkData chunkBuilder, BlockCoordinates blockCoordinates, Vector3 position, BlockState baseBlock) { var biome = world == null?BiomeUtils.GetBiomeById(0) : world.GetBiome(position); if (baseBlock.ModelData == null) { return; } if (baseBlock.VariantMapper.IsMultiPart) { foreach (var model in baseBlock.ModelData) { if (Resources.BlockModelRegistry.TryGet(model.ModelName, out var registryEntry)) { CalculateModel( world, blockCoordinates, chunkBuilder, position, baseBlock.Block, model, registryEntry.Value, biome); } } return; } // if (UseRandomizer) { BlockStateModel selectedModel = null; if (baseBlock.ModelData.Count > 1) { var weightSum = baseBlock.ModelData.Sum(x => x.Weight); var rnd = ((baseBlock.ModelData.Count == 1) ? 1f : MathF.Abs( NoiseGenerator.GetValue(position.X * position.Y, position.Z * position.X))) * weightSum; //for (var index = 0; index < Models.Length; index++) foreach (var model in baseBlock.ModelData) { // var model = Models[index]; rnd -= model.Weight; if (rnd < 0) { selectedModel = model; break; } } } else { selectedModel = baseBlock.ModelData.FirstOrDefault(); } if (selectedModel == null) { return; } if (Resources.BlockModelRegistry.TryGet(selectedModel.ModelName, out var registryEntry)) { CalculateModel( world, blockCoordinates, chunkBuilder, position, baseBlock.Block, selectedModel, registryEntry.Value, biome); } // CalculateModel(world, blockCoordinates, chunkBuilder, position, baseBlock, selectedModel.BlockStateModel, selectedModel.BlockModel, biome); } //else //{ //for (var bsModelIndex = 0; bsModelIndex < Models.Length; bsModelIndex++) //{ //var bsModel = Models[bsModelIndex]; // if (string.IsNullOrWhiteSpace(bsModel.ModelName)) continue; //} //} }
public BiomeMapComponent() { _biomeUtils = new BiomeUtils(); _biomeUtils.PrecomputeBiomeColors(); }
public DefaultLayerRenderer() { BiomeUtils = new BiomeUtils(); BiomeUtils.PrecomputeBiomeColors(); }
public virtual void AttemptMobSpawn(BlockCoordinates packCoord, Random random, bool canSpawnPassive, bool canSpawnHostile) { if (Level.Dimension != Dimension.Overworld) { return; } if (Level.Players.Count(player => player.Value.IsSpawned && Vector3.Distance(packCoord, player.Value.KnownPosition) < 24) != 0) { //if (Log.IsDebugEnabled) // Log.Debug($"Can't spawn entity because players within 24 blocks distance: {blockCoordinates}"); return; } if (!canSpawnHostile && !canSpawnPassive) { // Mob cap reached on all creatures return; } for (int c = 0; c < 2; c++) { int maxPackSize = int.MaxValue; int numberOfSpawnedMobs = 0; EntityType entityType = EntityType.None; bool doSpawnHostile = false; bool doSpawnPassive = false; if (c == 0) { if (!canSpawnHostile) { continue; } doSpawnHostile = true; } else if (c == 1) { if (!canSpawnPassive) { continue; } doSpawnPassive = true; } for (int j = 0; j < 3; j++) { int x = packCoord.X; int y = packCoord.Y; int z = packCoord.Z; // The next 3 (k, x and z) random construct heavily weigh the coordinates toward center of pack-origin int k = random.Next(1, 5); for (int i = 0; i < k && numberOfSpawnedMobs < maxPackSize; i++) { x += random.Next(6) - random.Next(6); z += random.Next(6) - random.Next(6); var spawnBlock = Level.GetBlock(x, y - 1, z); //FIXME: The following is wrong. It shouldn't be the same for all mobs and need to be moved into some sort of // entity-based "CanSpawn()" method. But performance need to be handled too, and this is way faster right now. if (spawnBlock is Grass || spawnBlock is Sand || spawnBlock is Gravel || (doSpawnHostile && spawnBlock.IsSolid && !spawnBlock.IsTransparent)) { if (entityType == EntityType.None) { entityType = SelectEntityType(spawnBlock, random, doSpawnHostile, doSpawnPassive); if (entityType == EntityType.None) { if (Log.IsDebugEnabled && doSpawnHostile) { Log.Debug($"Failed to spawn because found no proper entity types for biome {BiomeUtils.GetBiome(spawnBlock.BiomeId).Name}"); } break; } maxPackSize = entityType == EntityType.Wolf ? 8 : entityType == EntityType.Rabbit ? 2 + random.Next(1) : entityType == EntityType.Horse ? 2 + random.Next(5) : entityType == EntityType.Enderman ? 1 + random.Next(4) : 4; } var firstBlock = Level.GetBlock(x, y, z); if (!firstBlock.IsSolid && !(firstBlock is Stationary) && !(firstBlock is Flowing)) { if (doSpawnPassive && PassiveMobs.Contains(entityType) && Level.GetSubtractedLight(firstBlock.Coordinates, 0) >= 9) { var secondBlock = Level.GetBlock(x, y + 2, z); if ((spawnBlock is Grass || (entityType == EntityType.Rabbit && spawnBlock is Sand)) && !secondBlock.IsSolid) { var yaw = random.Next(360); if (Spawn(new PlayerLocation(x + 0.5, y, z + 0.5, yaw + 15, yaw), entityType, random)) { if (Log.IsDebugEnabled) { Log.Warn($"Spawned {entityType}"); } //Level.StrikeLightning(new PlayerLocation(x + 0.5, y, z + 0.5, yaw + 15, yaw)); //Level.SetBlock(new StainedGlass() { Metadata = (byte)firstBlock.SkyLight, Coordinates = firstBlock.Coordinates + BlockCoordinates.Down }); ++numberOfSpawnedMobs; } else { if (Log.IsDebugEnabled) { Log.Debug($"Failed to spawn {entityType} because area not clear"); } } } } else if (doSpawnHostile && HostileMobs.Contains(entityType) && Level.GetSubtractedLight(firstBlock.Coordinates) < random.Next(8)) { var secondBlock = Level.GetBlock(x, y + 1, z); if (!secondBlock.IsSolid) { var yaw = random.Next(360); if (Spawn(new PlayerLocation(x + 0.5, y, z + 0.5, yaw + 15, yaw), entityType, random)) { //Level.SetBlock(new StainedGlass() { Metadata = (byte) firstBlock.SkyLight, Coordinates = firstBlock.Coordinates + BlockCoordinates.Down }); //Log.Warn($"Spawned {entityType} at {firstBlock.Coordinates} at light level on bottom={firstBlock.SkyLight} amd top={secondBlock.SkyLight}, world time={Level.CurrentWorldTime}"); ++numberOfSpawnedMobs; } else { if (Log.IsDebugEnabled) { Log.Debug($"Failed to spawn {entityType} because area not clear"); } } } } } } } } } }
public BiomeMapControl(Level level) : base(null) { Level = level; _biomeUtils = new BiomeUtils(); _biomeUtils.PrecomputeBiomeColors(); }
protected (VertexPositionNormalTextureColor[] vertices, int[] indexes) GetVertices(IWorld world, Vector3 position, IBlock baseBlock, BlockStateModel[] models, IDictionary <string, FaceCache> faceCache) { var verts = new List <VertexPositionNormalTextureColor>(36); var indexResult = new List <int>(); int biomeId = world.GetBiome((int)position.X, 0, (int)position.Z); var biome = BiomeUtils.GetBiomeById(biomeId); for (var bsModelIndex = 0; bsModelIndex < models.Length; bsModelIndex++) { var bsModel = models[bsModelIndex]; if (bsModel.Model == null) { continue; } var model = bsModel.Model; var modelElements = model.Elements; for (var i = 0; i < modelElements.Length; i++) { FaceCache elementCache; if (!faceCache.TryGetValue($"{bsModel.ModelName}:{bsModelIndex}:{i}", out elementCache)) { Log.Warn($"Element cache is null!"); continue; } var element = modelElements[i]; foreach (var faceElement in element.Faces) { var facing = faceElement.Key; GetCullFaceValues(faceElement.Value.CullFace, facing, out var cullFace); var originalCullFace = cullFace; if (bsModel.X > 0f) { var offset = (-bsModel.X) / 90; cullFace = RotateDirection(cullFace, offset, FACE_ROTATION_X, INVALID_FACE_ROTATION_X); facing = RotateDirection(facing, offset, FACE_ROTATION_X, INVALID_FACE_ROTATION_X); } if (bsModel.Y > 0f) { var offset = (-bsModel.Y) / 90; cullFace = RotateDirection(cullFace, offset, FACE_ROTATION, INVALID_FACE_ROTATION); facing = RotateDirection(facing, offset, FACE_ROTATION, INVALID_FACE_ROTATION); } if (originalCullFace != BlockFace.None && !ShouldRenderFace(world, facing, position, baseBlock)) { continue; } FaceData faceVertices; if (!elementCache.TryGet(faceElement.Key, out faceVertices) || faceVertices.Vertices.Length == 0 || faceVertices.Indexes.Length == 0) { //Log.Debug($"No vertices cached for face {faceElement.Key} in model {bsModel.ModelName}"); continue; } Color faceColor = faceVertices.Vertices[0].Color; if (faceElement.Value.TintIndex >= 0) { if (biomeId != -1) { if (baseBlock.Name.Equals("grass_block", StringComparison.InvariantCultureIgnoreCase)) { faceColor = Resources.ResourcePack.GetGrassColor(biome.Temperature, biome.Downfall, (int)position.Y); } else { faceColor = Resources.ResourcePack.GetFoliageColor(biome.Temperature, biome.Downfall, (int)position.Y); } } } faceColor = AdjustColor(faceColor, facing, GetLight(world, position + cullFace.GetVector3(), false), element.Shade); var initialIndex = verts.Count; for (var index = 0; index < faceVertices.Vertices.Length; index++) { var vertex = faceVertices.Vertices[index]; vertex.Color = faceColor; vertex.Position = position + vertex.Position; verts.Add(vertex); } for (var index = 0; index < faceVertices.Indexes.Length; index++) { var idx = faceVertices.Indexes[index]; indexResult.Add(initialIndex + idx); } } } } return(verts.ToArray(), indexResult.ToArray()); }
public OverworldGenerator() { int seed = Config.GetProperty("seed", "YoHoMotherducker!").GetHashCode(); Seed = seed; BiomeModifierX = new SimplexPerlin(seed + 3700); BiomeModifierZ = new SimplexPerlin(seed + 5000); var rainSimplex = new SimplexPerlin(seed); var rainNoise = new Voronoi(); rainNoise.Primitive3D = rainSimplex; rainNoise.Primitive2D = rainSimplex; rainNoise.Distance = false; rainNoise.Frequency = RainFallFrequency; rainNoise.OctaveCount = 2; RainNoise = rainNoise; var tempSimplex = new SimplexPerlin(seed + 100); var tempNoise = new Voronoi(); tempNoise.Primitive3D = tempSimplex; tempNoise.Primitive2D = tempSimplex; tempNoise.Distance = false; tempNoise.Frequency = TemperatureFrequency; tempNoise.OctaveCount = 2; // tempNoise.Gain = 2.5f; TempNoise = tempNoise; var mainLimitNoise = new SimplexPerlin(seed + 200); var mainLimitFractal = new SumFractal() { Primitive3D = mainLimitNoise, Primitive2D = mainLimitNoise, Frequency = MainNoiseFrequency, OctaveCount = 2, Lacunarity = MainNoiseLacunarity, Gain = MainNoiseGain, SpectralExponent = MainNoiseSpectralExponent, Offset = MainNoiseOffset, }; var mainScaler = new ScaleableNoise() { XScale = 1f / MainNoiseScaleX, YScale = 1f / MainNoiseScaleY, ZScale = 1f / MainNoiseScaleZ, Primitive3D = mainLimitFractal, Primitive2D = mainLimitFractal }; //ModTurbulence turbulence = new ModTurbulence(mainLimitFractal, new ImprovedPerlin(seed - 350, NoiseQuality.Fast), new ImprovedPerlin(seed + 350, NoiseQuality.Fast), null, 0.0125F); _mainNoise = mainScaler; //turbulence; var mountainNoise = new SimplexPerlin(seed + 300); var mountainTerrain = new HybridMultiFractal() { Primitive3D = mountainNoise, Primitive2D = mountainNoise, Frequency = DepthFrequency, OctaveCount = 4, Lacunarity = DepthLacunarity, SpectralExponent = DepthNoiseScaleExponent, //Offset = 0.7f, Gain = DepthNoiseGain }; ScaleableNoise scaling = new ScaleableNoise(); scaling.Primitive2D = mountainTerrain; scaling.Primitive3D = mountainTerrain; scaling.YScale = 1f / HeightScale; scaling.XScale = 1f / DepthNoiseScaleX; scaling.ZScale = 1f / DepthNoiseScaleZ; _depthNoise = scaling; BiomeUtils.FixMinMaxHeight(); }