public override void Generate(MapMagic.Chunk chunk, Biome biome = null) { Matrix src = (Matrix)input.GetObject(chunk); if (src == null || chunk.stop) { return; } if (!enabled) { output.SetObject(chunk, src); return; } Matrix dst = new Matrix(src.rect); Coord min = src.rect.Min; Coord max = src.rect.Max; for (int x = min.x; x < max.x; x++) { for (int z = min.z; z < max.z; z++) { float val = level - src[x, z]; dst[x, z] = val > 0? val : 0; } } if (chunk.stop) { return; } output.SetObject(chunk, dst); }
public static void SetNeigsZ (Chunk prev, Chunk next) { next.neigPrevZ = prev.terrain; prev.neigNextZ = next.terrain; prev.terrain.SetNeighbors(prev.neigPrevX, prev.neigNextZ, prev.neigNextX, prev.neigPrevZ); next.terrain.SetNeighbors(next.neigPrevX, next.neigNextZ, next.neigNextX, next.neigPrevZ); }