/// <summary> /// Apply a mask on the heightmap. /// </summary> /// <param name="heightmask"></param> public void ApplyMask(Heightmask heightmask) { // Reject the heightmask if it doesn't fit. if ((_width != heightmask.Width) || (_depth != heightmask.Depth)) { return; } // Apply the heightmask. for (int x = 0; x < _width; ++x) { for (int z = 0; z < _depth; ++z) { _heightValues[x + z * _width] = (_heightValues[x + z * _width] - _minimumHeight) * heightmask.GetMaskValue(x, z) + _minimumHeight; } } }
/// <summary> /// Clone the heightmask. /// </summary> /// <returns></returns> public object Clone() { var heightmask = new Heightmask(_width, _depth, (float[])_maskValues.Clone()); return(heightmask); }
/// <summary> /// Apply a mask on the heightmap. /// </summary> /// <param name="heightmask"></param> public void ApplyMask(Heightmask heightmask) { // Reject the heightmask if it doesn't fit. if ((_width != heightmask.Width) || (_depth != heightmask.Depth)) { return; } // Apply the heightmask. for (int x = 0; x < _width; ++x) { for (int z = 0; z < _depth; ++z) { _heightValues[x + z*_width] = (_heightValues[x + z*_width] - _minimumHeight)* heightmask.GetMaskValue(x, z) + _minimumHeight; } } }
/// <summary> /// Clone the heightmask. /// </summary> /// <returns></returns> public object Clone() { var heightmask = new Heightmask(_width, _depth, (float[]) _maskValues.Clone()); return heightmask; }