diff options
Diffstat (limited to 'scene.cpp')
-rw-r--r-- | scene.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -1,5 +1,6 @@ #include "scene.h" #include "video.h" +#include "terrain.h" #include <SDL_image.h> #include <boost/format.hpp> @@ -46,18 +47,10 @@ Scene::Scene() { soil_texture = load_texture("textures/zooboing-469-sand-modified.jpg"); marker_texture = load_texture("textures/cross.png"); - /* load heightmap */ - SDL_Surface *hm = IMG_Load("heightmap.png"); - float *heightmap = new float[hm->w * hm->h]; - for(int x = 0; x < hm->w; x++) { - for(int y = 0; y < hm->h; y++) { - Uint8 *p = (Uint8*)hm->pixels + y * hm->pitch + x * hm->format->BytesPerPixel; - heightmap[y*hm->w + x] = ((float)(*p) / 256) * 20; - } - } - int w = hm->w; - int h = hm->h; - SDL_FreeSurface(hm); + /* init quadtree */ + int w = 1025; + int h = 1025; + float *heightmap = Terrain::generate_heights(0, 0, w, h); qt = new Quadtree(w, h, heightmap); /* load font */ |