summaryrefslogtreecommitdiff
path: root/quadtree.h
diff options
context:
space:
mode:
Diffstat (limited to 'quadtree.h')
-rw-r--r--quadtree.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/quadtree.h b/quadtree.h
index 951a98e..b927dee 100644
--- a/quadtree.h
+++ b/quadtree.h
@@ -3,8 +3,18 @@
#include "vector.h"
+#include <boost/thread.hpp>
+
class Quadtree {
public:
+
+ struct UpdateThread {
+ Quadtree *tree;
+ float *buffer;
+ UpdateThread(Quadtree *t, float *b);
+ void operator()();
+ };
+
struct QuadNode {
Quadtree *tree;
QuadNode *parent;
@@ -29,9 +39,15 @@ class Quadtree {
};
float *heights;
+ float *thread_buffer;
+ size_t buf_size;
+ bool thread_done, thread_running;
+ boost::mutex vbo_lock;
+ boost::mutex node_lock;
int width, height, levels;
float init_time;
QuadNode *root;
+ unsigned int temp_vbo;
unsigned int vbo_object;
unsigned int nodes;
unsigned int vertices;
@@ -43,6 +59,7 @@ class Quadtree {
void create_nodes(int levels);
unsigned int count_nodes();
void make_vbo();
+ void update_vbo();
QuadNode *find(float x, float y, int level = -1);
QuadNode *get_left(QuadNode *node);
QuadNode *get_right(QuadNode *node);