summaryrefslogtreecommitdiff
path: root/quadtree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'quadtree.cpp')
-rw-r--r--quadtree.cpp9
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) {