diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-05-01 21:24:44 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-05-01 21:24:44 +0200 |
commit | 965956ff2411bef4a26e66154fe56e6dc5d482ed (patch) | |
tree | 906785f5cbb96768f9e44d234748f000207a1507 /scene.cpp | |
parent | ae0130e815c353c7fc045d7bb510e919f0f87231 (diff) |
Added makefile, debugging stuff.
Diffstat (limited to 'scene.cpp')
-rw-r--r-- | scene.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -6,6 +6,7 @@ #include "gl.h" +#include <unistd.h> #include <cmath> #include <queue> @@ -48,17 +49,25 @@ Scene::Scene() { /* load heightmap */ SDL_Surface *hm = IMG_Load("heightmap.png"); + std::cout << (boost::format("size: %dx%d") % hm->w % hm->h).str() << std::endl; + std::cout << "size: " << hm->w << "x" << hm->h << std::endl; + printf("size: %dx%d\n", hm->w, hm->h); 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; + if(y*hm->w + x >= hm->w * hm->h) + std::cout << "foo" << std::endl; heightmap[y*hm->w + x] = ((float)(*p) / 256) * 20; } } int w = hm->w; int h = hm->h; SDL_FreeSurface(hm); + float *hmap = heightmap; + std::cout << "heightmap: " << heightmap << std::endl; qt = new Quadtree(w, h, heightmap); + std::cout << "qt: " << qt << std::endl; /* load font */ //font = new FTTextureFont("fonts/VeraMono.ttf"); @@ -140,6 +149,7 @@ bool Scene::select(int x, int y, float& px, float& py, float& pz) { } void Scene::update() { + std::cout << "qt: " << qt << std::endl; qt->update(pos.x, pos.z); } |