diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-04-04 00:01:39 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-04-04 00:01:39 +0200 |
commit | 095be9811eaccd92cee156b4c486fb92b77cdcd2 (patch) | |
tree | 354d6f28f0efd721748c0e052921b443ee86bd79 /quadtree.h | |
parent | 61fe986e9ad6d1f26275e2ffd72cae0c2542256c (diff) |
Threaded VBO creation.
A secondary memory-mapped VBO is filled in a separate thread, which
replaces the main VBO when work is done.
Diffstat (limited to 'quadtree.h')
-rw-r--r-- | quadtree.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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); |