WorldGenerator.cpp 406 B

1234567891011121314
  1. #include <cmath>
  2. #include "server/world/WorldGenerator.h"
  3. void WorldGenerator::generate(World& w) {
  4. for(int x = 0; x < w.blocks.getSize(); x++) {
  5. for(int z = 0; z < w.blocks.getSize(); z++) {
  6. int height = sinf(x * 0.25f) * 2.0f + cosf(z * 0.25f) * 2.0f + 6.0f;
  7. for(int y = 0; y < height; y++) {
  8. w.blocks.set(x, y, z, 1);
  9. }
  10. }
  11. }
  12. }