From 965956ff2411bef4a26e66154fe56e6dc5d482ed Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sun, 1 May 2011 21:24:44 +0200 Subject: Added makefile, debugging stuff. --- scene.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scene.cpp') diff --git a/scene.cpp b/scene.cpp index 7a2a740..bcec2bf 100644 --- a/scene.cpp +++ b/scene.cpp @@ -6,6 +6,7 @@ #include "gl.h" +#include #include #include @@ -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); } -- cgit v1.2.3