protected virtual void UpdateHeightMapEach(int y, DataForUpdateHeightMap arg) { for (var x = 0; x <= width; x++) { SetHeight(x, y, arg.H(arg.px.x * (x - 0.5f + _seeds.x), arg.px.y * (y - 0.5f + _seeds.y), arg.t)); } }
protected virtual IEnumerator UpdateHeightMap() { var px = new Vector2(noiseFreq * aspect / width, noiseFreq / width); var t = Time.timeSinceLevelLoad * timeScale + _seeds.z; var H = (HeightFunc == null ? DefaultHeightFunc : HeightFunc); var arg = new DataForUpdateHeightMap(px, t, H); return(Parallel.ForAsync(0, width + 1, UpdateHeightMapEach, arg)); }
void UpdateHeightMap() { var px = (float)noiseFreq / _height; var t = Time.timeSinceLevelLoad * timeScale + _seeds.z; var H = (HeightFunc == null ? DefaultHeightFunc : HeightFunc); var arg = new DataForUpdateHeightMap(px, t, H); Parallel.For(0, _height + 1, UpdateHeightMapEach, arg); }