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. --- quadtree.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'quadtree.cpp') diff --git a/quadtree.cpp b/quadtree.cpp index 65c60ae..3b329ac 100644 --- a/quadtree.cpp +++ b/quadtree.cpp @@ -343,11 +343,15 @@ Quadtree::QuadNode* Quadtree::QuadChunk::find(float x, float y) { /* Quadtree */ Quadtree::Quadtree(int width, int height, float *heightmap) { + std::cout << "width: " << width << " height: " << height << std::endl; + std::cout << "heightmap: " << heightmap << std::endl; + this->width = width; this->height = height; heights = heightmap; - root = new QuadChunk(this, 0, 0, width-1, height-1); + this->root = new QuadChunk(this, 0, 0, width-1, height-1); + std::cout << "root: " << root << std::endl; normals = new Vector3[width*height]; for(int x = 0; x < width; x++) { @@ -439,15 +443,18 @@ Vector3 Quadtree::calc_normal(int x, int y) { void Quadtree::update(float x, float z) { std::queue q; + std::cout << "root: " << root << std::endl; q.push(root); while(!q.empty()) { QuadChunk *chunk = q.front(); q.pop(); + std::cout << "chunk: " << chunk << std::endl; if(!chunk->nodes) { for(int i = 0; i < 4; i++) q.push(chunk->children[i]); continue; } + std::cout << "foo" << std::endl; float d = chunk->distance(x, z); if(d < 100 && !chunk->vbo_object) { -- cgit v1.2.3