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 /quadtree.cpp | |
parent | ae0130e815c353c7fc045d7bb510e919f0f87231 (diff) |
Added makefile, debugging stuff.
Diffstat (limited to 'quadtree.cpp')
-rw-r--r-- | quadtree.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
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<QuadChunk*> 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) { |