/// <summary> /// A mask to make temperature look right. /// </summary> /// <param name="mapValue">The input value.</param> /// <param name="y">The Y Coord of this value.</param> /// <param name="maxY">The height of the world.</param> /// <returns>The elevation to use.</returns> private static float TempertureMask(float mapValue, int y, int maxY) { const int MinTemp = 0; const int MaxTemp = 80; float initialValue = (mapValue / 255f * 40f) - 20f; float position = (float)y / (float)maxY * 2; float positionInverse = (1.0f - ((float)y / (float)maxY)) * 2; float baseValue = position <= 1.0f ? Masks.Lerp(MinTemp, MaxTemp, position) : Masks.Lerp(MinTemp, MaxTemp, positionInverse); return(baseValue + initialValue); }
/// <summary> /// A mask to make elevation look right. /// </summary> /// <param name="initalValue">The input value.</param> /// <param name="x">The X coord of this value.</param> /// <param name="y">The Y coord of this value.</param> /// <param name="maxX">The width of the world.</param> /// <param name="maxY">The height of the world.</param> /// <returns>The elevation to use.</returns> private static float ElevationMask(float initalValue, int x, int y, int maxX, int maxY) { const float ColdFadeStart = 0.20f; return (Masks.FadeToZeroAtEnds( ColdFadeStart, y, maxY, Masks.FadeToZeroAtEnds( ColdFadeStart, x, maxX, initalValue))); }