Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. for(int y = 0; y < HEIGHT; y++) {
  2.     for(int x = 0; x < WIDTH; x++) {
  3.         float fx = (1.0f / (float)WIDTH); // multiply fx, fy
  4.         float fy = (1.0f / (float)HEIGHT); // to scale perlin sampling.
  5.         float height = perlin_2d(fx, fy); // maybe add seed somewhere.
  6.  
  7.         int offset = x + (y * WIDTH);
  8.         verts[offset].x = (float)x;
  9.         verts[offset].y = height;
  10.         verts[offset].z = (float)y;
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement