Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float Gen_Height(int x, int y, int seed)
- {
- float height = 0;
- float newx;
- float newy;
- for (float resolution = 128; resolution >= 8; resolution /= 8)
- {
- newx = (seed / 40f) / resolution + x / resolution;
- newy = (seed / 40f) / resolution + y / resolution;
- height += (Mathf.PerlinNoise(newx, newy) - 0.5f) * resolution;
- }
- if (height < 0) height = 0;
- return height;
- }
- public List<Vector3> Gen_Vertices(int chunkx, int chunky, int seed)
- {
- float height;
- int x = 101;
- List<Vector3> vertices = new List<Vector3>();
- for (int i = 0; i < x; i++)
- {
- for (int j = 0; j < x; j++)
- {
- height = Gen_Height(i + chunkx * (int)x, j + chunky * (int)x, seed) * heightmod;
- vertices.Add(new Vector3(2*i, height,2* j));
- if (height > maxheight) maxheight = height;
- else if (height < minheight) minheight = height;
- }
- }
- return vertices;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement